That is right, evoke&6 deals with atomic representations (or equivalent) not necessarily with linear representations, quoting myself:
"This is not suitable for the purposes that Pascal has in mind (that is an ideal job for wl (104!:1)); but, apply can return any kind of words." Word from linear (wl), unlike eval, is immune to potential contextual unwanted side effects; for example, PHI=. 2%~1+%:5 PHI 1.61803399 erase'PHI' 1 'PHI=. 2%~1+%:5'wl PHI 1.61803399 erase'PHI' 1 'PHI=. 2%~1+%:5'eval 1.61803399 PHI |value error: PHI You would have to think about the explicit context and use =: instead; I prefer to avoid all those issues entirely. On Tue, Apr 8, 2014 at 7:02 PM, Pascal Jasmin <[email protected]>wrote: > evoke6=: evoke&6 > > eval2 =: 'evoke6 @: <' apply ] > > > +:(eval2'@')+/1 2 3 > > 22 > +:( eval2']')+/1 2 3 > 12 > +:( eval2'4:')+/1 2 3 > 8 > > note that it only works for verbs/modifiers. domain error for nouns, and > also: > > +:( eval2'4"_')+/1 2 3 > |domain error > > but: > a=. 4"_ > +:( eval2'a')+/1 2 3 > 8 > > indirect integers work: > > b > 4 > +:( eval2'b')+/1 2 3 > 10 12 14 > > +: 4 +/ 1 2 3 > 10 12 14 > > if result is an adverb or monadic verb , no need for parens: (use them to > be safe) > > + eval2'/' 1 2 3 > 6 > > there is a domain error if the argument is longer than one token. ie. > > (eval2 ('+/')) 1 2 3 > |domain error > > ba =. +/ > 2 eval2 'ba' 1 2 3 > 6 > 2 (eval2 'ba') 1 2 3 > 3 4 5 > > > > ----- Original Message ----- > From: Jose Mario Quintana <[email protected]> > To: Programming forum <[email protected]> > Cc: > Sent: Tuesday, April 8, 2014 5:22:28 PM > Subject: Re: [Jprogramming] an improvement to apply and perhaps anon evoke > > That is right, > > evoke=. (<'`:')(0:`)(,^:) > 'evoke&6 @: <' apply '@' > @ > > This is not suitable for the purposes that Pascal has in mind (that is an > ideal job for wl (104!:1)); but, apply can return any kind of words. > > "To see and listen to the wicked is already the beginning of wickedness." > > ;) > > > On Mon, Apr 7, 2014 at 7:46 PM, Raul Miller <[email protected]> wrote: > > > Actually, thinking about it, that's just apply acting as a verb. > > > > Presumably to produce a verb it's either using the "wicked power' bug or > a > > custom hack to the interpreter. > > > > Personally, I have enough problems with J crashing on me and am hoping to > > fix such issues, so I stay away from verbs returning non-nouns. > > > > Thanks, > > > > -- > > Raul > > > > > > On Mon, Apr 7, 2014 at 7:41 PM, Raul Miller <[email protected]> > wrote: > > > > > Note that you quoted this text: > > > > > > 2 ('+/' apply ,) 3 > > > 5 > > > > > > ;) > > > > > > Thanks, > > > > > > -- > > > Raul > > > > > > > > > On Mon, Apr 7, 2014 at 6:22 PM, Pascal Jasmin <[email protected] > > >wrote: > > > > > >> '@u'eval > > >> @a: > > >> > > >> '@u' 1 : ''''' 1 : m' > > >> @'' > > >> > > >> > > >> You are right about it being fairly easy to shoehorn any dyadic verb > > into > > >> a modad for apply, but there is a simplicity to eval when a large > boxed > > >> structure made of several variables is the left hand part. > > >> > > >> > PPS. For the record: perhaps apply (128!:2) should not produce > > adverbs > > >> or > > >> conjunctions (or verbs); but, it can. > > >> > > >> I won't say I don't believe you, but I don't know how. :) > > >> > > >> > > >> > > >> > > >> > > >> ----- Original Message ----- > > >> From: Jose Mario Quintana <[email protected]> > > >> To: Programming forum <[email protected]> > > >> Cc: > > >> Sent: Monday, April 7, 2014 4:32:47 PM > > >> Subject: Re: [Jprogramming] an improvement to apply and perhaps anon > > evoke > > >> > > >> I have used similar tools for related purposes before; nowadays I use > > the > > >> word-from-linear (104!:1) extension. It is not a secret that I have > an > > >> aversion to explicit definitions; one reason is that they change the > > >> context: > > >> > > >> wl=. 104!:1 > > >> eval =: 1 : ' a: 1 : m' > > >> > > >> < '@' eval +'/' eval 1 2 3 > > >> ┌─┐ > > >> │6│ > > >> └─┘ > > >> < '@' wl +'/' wl 1 2 3 > > >> ┌─┐ > > >> │6│ > > >> └─┘ > > >> > > >> So far, so good; however, > > >> > > >> @u > > >> @u > > >> '@u'wl > > >> @u > > >> '@u'eval > > >> @a: > > >> > > >> PS. Apply (128!:2) only can refer to a verb that take a single > > argument, > > >> and J verbs can take only one or two arguments. I regard both > > situations > > >> as very minor annoyances. It is not difficult to circumvent this > > >> “limitation” of apply (and, of course, J verbs can take virtually > > several > > >> arguments), for example, > > >> > > >> 2 ('+/' apply ,) 3 > > >> 5 > > >> > > >> PPS. For the record: perhaps apply (128!:2) should not produce > adverbs > > or > > >> conjunctions (or verbs); but, it can. > > >> > > >> > > >> > > >> > > >> > > >> > > >> On Sat, Apr 5, 2014 at 1:26 PM, Pascal Jasmin <[email protected] > > >> >wrote: > > >> > > >> > apply does not work with dyadic verbs, and cannot produce modifiers. > > >> > Consider the following simple looking eval function. > > >> > > > >> > eval =: 1 : ' a: 1 : m' > > >> > > > >> > > > >> > 2 '+' eval 1 2 3 > > >> > 3 4 5 > > >> > > > >> > > > >> > + '/' eval 1 2 3 > > >> > 6 > > >> > > > >> > > > >> > > > >> > '+/' eval(+:@) 1 2 3 > > >> > 12 > > >> > > > >> > > > >> > +:@+'/' eval 1 2 3 > > >> > 22 > > >> > > > >> > > > >> > +: +'/' eval 1 2 3 > > >> > 12 > > >> > > > >> > > > >> > (+: '@' eval +)'/' eval 1 2 3 > > >> > > > >> > 22 > > >> > > > >> > +: '@' eval +'/' eval 1 2 3 > > >> > 12 > > >> > > > >> > > > >> > The last statement is interesting because it seems to alter the > normal > > >> > conjunction train processing (sometimes in desirable ways) > > >> > > > >> > instead of just grabbing a single token as v. > > >> > > > >> > < '@' eval +'/' eval 1 2 3 NB. would be domain error without > > '@'eval > > >> > ┌─┐ > > >> > │6│ > > >> > └─┘ > > >> > > > >> > > > >> > eval is the key to how my multiline tacit code works: > > >> > > > >> > > > http://www.jsoftware.com/jwiki/PascalJasmin/Multiline%20tacit%20expressions%20with%20macros > > >> > > ---------------------------------------------------------------------- > > >> > 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 > > > ---------------------------------------------------------------------- > 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
