Some things to consider: You can evaluate sentences without using ". $0!:100 'a=. 3' 0 0 a 3
This mechanism can be especially important when using the result of 5!:5. Also, if you really do not like parenthesis, you can do something like this: F=: +/ :d=. +/@, Thanks, -- Raul On Wed, Jun 11, 2014 at 4:17 PM, 'Pascal Jasmin' via Programming < [email protected]> wrote: > I wrote something else cool instead: > > Parsing function parameters outside of the function: > last section at: > http://www.jsoftware.com/jwiki/PascalJasmin/J%20tricks%20with%20assign > > > One thing that is still stumping me, is there any way (no matter how > hackish) at all to get : to capture its right hand side as the entire > expression instead of the "greedy right" conjunction behaviour? (so as to > avoid parens) > > > ----- Original Message ----- > From: Dan Bron <[email protected]> > To: [email protected] > Cc: > Sent: Wednesday, June 11, 2014 9:54:55 AM > Subject: Re: [Jprogramming] copula > > Yeah, that's the standard approach. > > In general, unlike explicit code, tacit code does not introduce a new > explicit context (local namespace), and so it operates within (and can > interact with) an explicit caller's local namespace (i.e. the anonymous > temporary namespace created upon entry to the explicit caller). > > That's one driver behind tools like anonymous evoke, etc. > > -Dan > > PS: Now you want a fun challenge? Write a verb, which, given a name, > determines whether that name is local or global (i.e. was assigned with =. > or =: ). It's possible, and has its uses. > > ----- Original Message --------------- > > Subject: Re: [Jprogramming] copula > From: "'Pascal Jasmin' via Programming" <[email protected]> > Date: Wed, 11 Jun 2014 06:48:44 -0700 (PDT) > To: "[email protected]" <[email protected]> > > > it's possible to emulate them as used-defined utilities (eg asgn=:dyad > def '(x)=:y' or '(y)=:y~' for things like += etc). > > good explanation, but something missing from J is the ability to use those > tricks with =. affecting the caller. Though this topic comming up finally > led me to a solution: > > lr > 3 : '5!:5 < ''y''' > > lassign =: 4 : ' x , ''=. '', lr y ' (".@:) > > 'a' lassign 3 > 3 > a > 3 > > f =: 3 : ' +: a [ ''a'' lassign y' 6 > f 6 > 12 > a > 3 > > > > > ----- Original Message ----- > From: Dan Bron <[email protected]> > To: "[email protected]" <[email protected]> > Cc: > Sent: Wednesday, June 11, 2014 9:19:29 AM > Subject: Re: [Jprogramming] copula > > If copulas were verbs, what would happen here? > > count=:77 > msg=:'count' > msg=:msg,': ',":count > > Or, better yet: > > count=: count +1 > > Similar remarks apply to the question of whether copulae should be adverbs > or conjunctions. In short: in order to see a /name/ on the left, as > opposed to a /value/, copulae need a special parsing rule with higher > precedence (binding power) than any nameclass. Which means copulae can't > operate "normally" (as expected, ie name=:value) and also participate as > one of the kinds of names (nameclasses) it can assign, or bind. > > With that said, it's possible to have a different set of copulae, distinct > from =: and =., that act like verbs (or adverbs, or conjunctions), and do > what you want, so long as you can live with the limitation that this > lower-power kind of copula cannot, itself, assign verbs (respectively, > adverbs or conjunctions). > > I don't we will ever implement these as primitives in the language, but > it's possible to emulate them as used-defined utilities (eg asgn=:dyad def > '(x)=:y' or '(y)=:y~' for things like += etc). > > -Dan > > Please excuse typos; sent from a phone. > > > On Jun 11, 2014, at 9:00 AM, David Lambert <[email protected]> > wrote: > > > > I'd like to know the reasoning that copula are not verbs please. > > > > B > > |value error: B > > > > (=:~ ('A B C ' {.~ +:@#))i.2 > > |syntax error > > | (=: ~('A B C '{.~+:@#))i.2 > > > > > > assign=: 4 :'EMPTY [ (x)=: y' > > > > (assign~ ('A B C ' {.~ +:@#))i.2 > > > > B > > 1 > > > > ---------------------------------------------------------------------- > > 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
