Re: [Jprogramming] Novice problem

2013-11-17 Thread Don Kelly
You sent an answer to my question before I asked it! Thanks- I suspected but didn't know that this was it. I think that I will stay with the earlier definition: rms=:[:%:[:(+/%#)*: which, while it does have brackets is somewhat more readable for my present state of understanding. Yours is sho

Re: [Jprogramming] Novice problem

2013-11-17 Thread Don Kelly
Thanks - This is what I had concluded and Jasmin and Linda have also emphasized the [: rather than @: Both, in this case do what I wanted. Don On 16/11/2013 9:43 PM, km wrote: Focus on what you want to DO. You want to do "the square root of the mean of the square". A novice's tip for using

Re: [Jprogramming] Novice problem

2013-11-17 Thread Don Kelly
That is neat and does give me further material to think about. I note that &. doesn't work (as I expected from the dictionary entry) but &.: so I have to figure this out Is it because that in u%.v y the u is applied to each element of y and for &.: it is applied to the whole of y? Don On

Re: [Jprogramming] Novice problem

2013-11-17 Thread Don Kelly
Thank you and Linda for clarification and explanation -I can see the reasoning behind the use of capped forks. It is what the 13: gives. Also, while @: works in this case- it does so only because mean is monadic. In other cases- problems. I will go over the references that you gave me. Don

Re: [Jprogramming] repeatuntil and repeat while tacit definitions possible?

2013-11-17 Thread Pascal Jasmin
I think there is a "bug" or needless slowdown in the implicit code interpreter. before it disapears from my edit bufffers, a slight variation on your code a2 =. ( 1e3 $ 2) , 2 1 3 2 4 5 2, 1e1 $ 2 a =. ( 1e3 $ 2) , 2 1 3 2 4 5 2, 1e5 $ 2    ((( $:@:}.)^:(6>:{.))^:_) @: dh :: (_"_)  a2 8 5 2 2 2 2

Re: [Jprogramming] Sets please help

2013-11-17 Thread km
Henry, thanks for your help. 4 is the expected level of a set whose elements are sets. Here's how it works: 1;2 NB. boxes contain proposed elements 1 and 2 +-+-+ |1|2| +-+-+ set 1;2 NB. boxes containing elements are "fenced in" +-+ |+-+-+| ||1|2|| |+-+-+| +-+ (set 1;2); On Nov

Re: [Jprogramming] repeatuntil and repeat while tacit definitions possible?

2013-11-17 Thread Jose Mario Quintana
We can check it out, dh=. ([ smoutput)@:(+:@:(0&({::)) 0} ]) ({.@:((dh @: }.^:(6>:{.)^:_)) @: dh) :: ('None found'"_) 2 1 3 2 4 5 2 4 1 3 2 4 5 2 2 3 2 4 5 2 6 2 4 5 2 4 4 5 2 8 5 2 8 So, v (+: in this case) is evaluated only until the condition is met. What happens is that if the verb

Re: [Jprogramming] Sets please help

2013-11-17 Thread Henry Rich
It looks to me that ps adds an extra level of boxing. Check the result of ps set ;:'a b' to see if I'm wrong. The verbs need to have appropriate ranks. I am not sure what they should be but I will make my guesses: sf"0 0"_ 0 sn"0 1 0 eo"_ 0 but this shows up a need for an eo that take

[Jprogramming] Sets please help

2013-11-17 Thread km
Will you try to "break" the following proposal before I post it on the J Wike? Thanks, -- Kip Murray NB. J SETS PROPOSAL NB. This ia a script you can copy and save, then load or loadd. NB. INTRODUCTION NB. Part of each set is its enclosing box. Like a Venn diagram set. NB. A set is a box

Re: [Jprogramming] repeatuntil and repeat while tacit definitions possible?

2013-11-17 Thread Pascal Jasmin
Thank you so much.  A lot of the motivation for the question was hoping to have my thinking expanded. For those following along, the use of 0&{:: is interesting as an alternative to {. because it will generate an error when the list runs out. Your second version advertised as lazy, though, seem

Re: [Jprogramming] Where has "clipread" gone in J801

2013-11-17 Thread bill lam
wd clipcopy and clippaste commands have been reinstated in j8 jqt. In additon, new clipcopyx and clippastex commands have been added which can handle image file. Please see jqt wd reference in jwiki. Пн, 18 ноя 2013, Piet de Jong писал(а): > I use it for copy/paste data from Excel. > Works great

Re: [Jprogramming] Sets

2013-11-17 Thread km
You now have a /list/ of sets. To get a /set/ of sets, put a large box around your list! Also rewrite psla so its argument is the /set/ <1;2;3 (not the /list/ 1;2;3). --Kip Sent from my iPad > On Nov 17, 2013, at 5:13 AM, "Linda Alvord" wrote: > > > Click above to see sets! > > > ]set=

Re: [Jprogramming] repeatuntil and repeat while tacit definitions possible?

2013-11-17 Thread Jose Mario Quintana
Pascal Jasmin writes: But I'd like to see the first before I ask for another, and the approach of finding them all and then returning the first is not practical. Arie Groeneveld writes: {.@(}.^:(6>:{.)^:_@: +:) 2 1 3 2 4 5 2 8 Presumably "is not practical" because the verb v in the

Re: [Jprogramming] Where has "clipread" gone in J801

2013-11-17 Thread Tom Arneson
Here's what I use in J801 require '~addons\general\misc\clippaste.ijs' NB. - NB. use: Copy ExpertGPS waypoint decsription to the clipboard NB. dist fd '' NB. then paste into ExpertGPS description field NB. may use as moda

Re: [Jprogramming] Where has "clipread" gone in J801?

2013-11-17 Thread greg heil
Dave Mitchell did enter a script, clippaste.ijs, in general/misc documented at http://www.jsoftware.com/jwiki/Scripts/WindowsClipboard greg ~krsnadas.org -- from: Piet de Jong reply-to: programm...@jsoftware.com to: Programming forum date: 17 November 2013 13:46 subject: [Jprogramming] Where h

[Jprogramming] Where has "clipread" gone in J801?

2013-11-17 Thread Piet de Jong
I use it to copy/paste data from Excel etc files. Works great in J7 -- For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] Where has "clipread" gone in J801

2013-11-17 Thread Piet de Jong
I use it for copy/paste data from Excel. Works great in J7 -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Sets

2013-11-17 Thread Jose Mario Quintana
"Grey" and gray are related but they take different arguments and produce different results. However, we can compare Gray (derived from Grey) and gray. Gray is shorter than gray, ( gray=. [: -. [: (= (_1 |.!.0"1 ])) bin f. ) NB. Fixed [: -. [: (= (_1 |.!.0"1 ])) 2 2 2 2&#: ( Gray=. #: @:

Re: [Jprogramming] Novice problem

2013-11-17 Thread Bo Jacoby
Shorter version of root-mean-square using &.:    rms=.(+/%#)&.:*:    rms 1 2 1 2 1.58114 Den 16:23 søndag den 17. november 2013 skrev Raul Miller : Here's another definition of rms > >  Rms=: +/@:*: %:@% # >  Rms 1 2 1 2 >1.58114 > >Explanation: > >We do not need to square the numbers in

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Raul Miller
Yes, sorry. (I keep making the mistake of expressing myself in terms of behavior instead of in terms of implementation.) Note also that you can use a noun define (0 :0) and create a mini substitution language for variable interpolation, or whatever. That might be worthwhile if you are doing a lot

Re: [Jprogramming] Sets

2013-11-17 Thread Bo Jacoby
This program for graycode may be simpler?    bin=.2 2 2 2&#:    gray=.[:-.[:(=_1|.!.0"1])bin    bin i.16 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1    gray i.16 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 0 1

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Pascal Jasmin
good idea, small correction, you mean create method instead of conew. If it is a multiline definition, we need to use the same ; trick I did for:  2 : (':';'u a__x v y') - Original Message - From: Raul Miller To: Programming forum Cc: Sent: Sunday, November 17, 2013 2:18:17 PM Subj

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Raul Miller
In other words, for this example: w =: conew 'myl' a__w =: 4 c__w =: 2 : 'u a v y' c2__w =: 2 : 'u@:(a&v)' put the definition of c__w and c2__w inside conew, and instead of simply referring to a, refer to a_',(>w),'_ (Note that I have assumed an explicit quoted context here.) Thanks, -- Raul

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Pascal Jasmin
> And you can, of course, have conew create a new instance of theconjunction in >the numbered locale. I likely don't understand what you are suggesting here. is it: w =: conew 'myl' a__w =: 4 c__w =: 2 : 'u a v y' c2__w =: 2 : 'u@:(a&v)' That doesn't address the bug, because c__w only sees 'a'

Re: [Jprogramming] Sets

2013-11-17 Thread Jose Mario Quintana
Thanks for the assertion and the correction. I knew it was named after a person, hence the upper case G, but I am one of those that reads and writes phonetically (if you know what I mean) and I could not see (hear) the difference between Gray and grey. On Sun, Nov 17, 2013 at 12:06 PM, Henry Rich

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Raul Miller
On Sun, Nov 17, 2013 at 12:12 PM, Pascal Jasmin wrote: >> And it's rather trivial for a conjunction > to access the state of its native locale (just be explicit about > that). > > It's trivial for static locale, but fails for numbered locales derived with > conew, because the code will never have

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Pascal Jasmin
To rephrase what you are saying... it should remain a bug. It should still be called a bug in the sense that there is no sane intent of defining a modifier in a locale that relies on the caller's locale definitions, or not something in its own copath.  The issue of no possible workaround for nu

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Pascal Jasmin
> And it's rather trivial for a conjunction to access the state of its native locale (just be explicit about that). It's trivial for static locale, but fails for numbered locales derived with conew, because the code will never have access to the number unless the caller passes it. -- which is

Re: [Jprogramming] Sets

2013-11-17 Thread Henry Rich
Oh - and it's Gray code, not Grey. It's named not because you don't have black-to-white transitions on more than one bit at a time; it's named for Frank Gray. Henry Rich On 11/17/2013 11:24 AM, Jose Mario Quintana wrote: My understanding is that Grey codes encode numbers in such a way that t

Re: [Jprogramming] Sets

2013-11-17 Thread Henry Rich
No, you're right. Henry Rich On 11/17/2013 11:24 AM, Jose Mario Quintana wrote: My understanding is that Grey codes encode numbers in such a way that the binary representation of consecutive numbers (including the last and first couple) in the sequence can be produced, one from the other, by fl

Re: [Jprogramming] Sets

2013-11-17 Thread Jose Mario Quintana
My understanding is that Grey codes encode numbers in such a way that the binary representation of consecutive numbers (including the last and first couple) in the sequence can be produced, one from the other, by flipping only one bit. For example, the binary representation of a four bit Grey seque

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Henry Rich
This is not a bug and the explanation is in my long message. Briefly, c_my1_ executes in my1, but the derived verb (>: c_myl_ +) executes in the user's locale. Note that c references a when the derived verb is executed, but cp references a when cp itself is executed. This really points out t

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Raul Miller
In J (and APL) the ideal is for relevant state to be present in the arguments. The locales were designed as a way of encapsulating design so that what one person builds can be used by another person without having to worry too much about naming. And it's rather trivial for a conjunction to access

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Pascal Jasmin
I added a bug report and narrowed down the issue: Most likely the error occurs when a modifier definition accesses y.  This cannot be intentional design because one locale's definition cannot possibly rely on another locale's state, and the primary reason for defining a modifier in a specific l

Re: [Jprogramming] Novice problem

2013-11-17 Thread Raul Miller
Here's another definition of rms Rms=: +/@:*: %:@% # Rms 1 2 1 2 1.58114 Explanation: We do not need to square the numbers in the argument to #, we only need to square them in the argument to +/ We only need the square root on the result of % Makes sense? Also, here's a partial explanat

Re: [Jprogramming] repeatuntil and repeat while tacit definitions possible?

2013-11-17 Thread Don Guinn
$: is recursive where the explicit version it iterative. -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] repeatuntil and repeat while tacit definitions possible?

2013-11-17 Thread Pascal Jasmin
thanks very much for both those solutions. The first (with $:) is very slow with large inputs.  The 2nd pretty good.  The tacit vs. explicit favours tacit for short circuiting about 5k items or less.   With 2x performance advantage at 1k or less. For larger test the explicit version stays at lin

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread bill lam
go to jwiki main page, look for the 'system requests & bug reports'. 17.11.2013, в 21:17, Pascal Jasmin написал(а): > is restarting J enough for a clean session? > where would I file a bug report? > > > - Original Message - > From: bill lam > To: programm...@jsoftware.com > Cc: > Sen

Re: [Jprogramming] bug in conjunction locales?

2013-11-17 Thread Pascal Jasmin
is restarting J enough for a clean session? where would I file a bug report? - Original Message - From: bill lam To: programm...@jsoftware.com Cc: Sent: Sunday, November 17, 2013 2:44:13 AM Subject: Re: [Jprogramming] bug in conjunction locales? Please test on a clean session.  If the

Re: [Jprogramming] Sets

2013-11-17 Thread Linda Alvord
Here's the attachment -Original Message- ment From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda Alvord Sent: Sunday, November 17, 2013 6:14 AM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Sets Click abo

Re: [Jprogramming] Sets

2013-11-17 Thread Linda Alvord
Click above to see sets! ]set=:<1;2;3 ┌───┐ │┌─┬─┬─┐│ ││1│2│3││ │└─┴─┴─┘│ └───┘ This match my idea of sets and subsets. The subsets are “names” for the subsets. psla=: 13 :'<"0<"0 <"1 |:((>:i.#y)*/"0 |:(|:|.|:(#y)#2)#:i.2^#y){A=:'' '',":10#.>>y' psla 1;2;3 ┌─

Re: [Jprogramming] repeatuntil and repeat while tacit definitions possible?

2013-11-17 Thread Aai
$:@}.`{.@.(6<{.) +: 2 1 3 2 4 5 2 8 much slower {.@(}.^:(6>:{.)^:_@: +:) 2 1 3 2 4 5 2 8 But I prefer Raul's solution. On 17-11-13 03:38, Pascal Jasmin wrote: I spent some time describing the application. You can also think of the application as search every web page on every ipv4 u