Thanks for replying, everyone.Sorry the formatting was all garbled. It was copy and pasted. It seems, for me at least, that >./ @ q: is the simplest and most elegant way to do it. I'm still struggling with the @ and & purposes, but I think only reading the explanations more carefully can fix that.
Regards,Jon > From: rauldmil...@gmail.com > Date: Wed, 26 Feb 2014 09:49:25 -0500 > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Finding Largest Prime of Numbers (Tacit) > > When I want to see inside the execution of a tacit verb, I usually > introduce verbs that let me see or grab values. > > For example: > (#~ [:(e. p:)+/\@:=&' ')'this is an example of something' > an example something > > So here's a couple verbs, to see values and to grab them: > > see=: 1!:2&2 > grab=: 3 :'KEEP=:y' > > And here's how they might look in action: > > (#~ [:see@(e. grab@p:)+/\@:=&' ')'this is an example of something' > 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 > an example something > > KEEP > 13 > > Obviously there are limits to this technique, so it requires a little > thought and you especially need to think about rank. That's not > entirely a bad thing. > > (#~ [:see@(e. grab@:p:)+/\@:=&' ')'this is an example of something' > > What do you think KEEP looks like this time? > > Thanks, > > -- > Raul > > > On Wed, Feb 26, 2014 at 3:03 AM, Linda Alvord <lindaalv...@verizon.net> wrote: > > Trace has a problem. It works fine with an explicit statement. > > > > require'trace' > > trace 'f=:{: 3 p: 23434' > > --------------- 2 Dyad ------- > > 3 > > p: > > 23434 > > 2 11717 > > --------------- 0 Monad ------ > > {: > > 2 11717 > > 11717 > > --------------- 7 Is --------- > > f > > =: > > 11717 > > 11717 > > ============================== > > 11717 > > > > This is ok. Now try the tacit expression. > > > > f 23434 > > 11717 > > f > > [: {: 3 p: ] > > > > > > trace 'g=:[: {: 3 p: 23434' > > --------------- 2 Dyad ------- > > 3 > > p: > > 23434 > > 2 11717 > > --------------- 1 Monad ------ > > {: > > 2 11717 > > 11717 > > --------------- 0 Monad ------ > > [: > > 11717 > > |domain error: executet > > | t_z=. ([:)(11717) > > > > > > Is trace not appropriate for tacit verbs? > > > > Linda > > > > -----Original Message----- > > From: programming-boun...@forums.jsoftware.com > > [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of David Lambert > > Sent: Tuesday, February 25, 2014 1:13 AM > > To: programming > > Subject: Re: [Jprogramming] Finding Largest Prime of Numbers (Tacit) > > > > j is a multiple instruction single data language and has many many ways > > to pass data, including as far as I can tell all combinations of > > monadic, dyadic verbs considering single verbs, their obverses where > > practical, the trains of even numbers of verbs, and of odd numbers of > > verbs with more than two verbs. Trains have infinite rank, that's why > > we cannot consider a single verb as a train. The train/rank question > > often appears first with table. (Usually) use the train atomically, at > > rank 0 . > > > > X train"0/ Y > > > > Assigning a list of verbs to a proverbial name is a most surprising > > aspects of j, one which I didn't realize from the documents for a long > > long time. Where stated "Substituted as if in parentheses." is an > > absolutely huge short sentence. Parentheses completely change (what I > > thought I had as) the sentence. If > > > > {: q: 45 > > 5 > > > > biggest_prime_factor_wrong =: {: q: > > > > biggest_prime_factor_wrong 45 > > |domain error: biggest_prime_factor_wrong > > | biggest_prime_factor_wrong 45 > > > > biggest_prime_factor_wrong is a hook with hook data passing. {: doesn't > > have a dyadic definition. Hence the domain error of > > ({: q:) 45 NB. equivalent to 45 {: q: 45 > > > > As far as I can tell, cap in a fork effectively means to use the monadic > > definition of the verb immediately to that cap's right. > > > > biggest_prime_factor =: [: {: q: > > > > biggest_prime_factor 45 > > 5 > > > > Other choices. Of those that are correct for a purpose the performance > > can drastically vary. Use the largest chunks possible to keep j from > > devoting resources to checking data types, frames, and item rank. > > Conjunctions here bind first, and from left to right form verbs: > > > > {:@q: 45 > > 5 > > {:@:q: 45 > > 5 > > {:&q: 45 > > 5 > > {:&:q: 45 > > 5 > > > > I've personally chosen to write verbs tacitly in the interpreter session > > with parentheses, using under, at, atop, compose, or appose when I can > > so that I can directly create proverbs. Having little faith in the > > future ordering of prime factors, I'd use bpf =: ([: >./ q:) , > > emphasizing the train with parentheses. > > > > Stick with j though it may take years, and please pounce on my errors, > > David Lambert > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm