In a related message, http://www.jsoftware.com/pipermail/beta/2014-November/007756.html
Dan wrote: > This question came up a few months ago; please read through > http://www.jsoftware.com/pipermail/programming/2014-June/037704.html His message is reproduced below with my interjections (and in its original form at the bottom) ... > [Jprogramming] copula > Dan Bron j at bron.us > Wed Jun 11 13:19:29 UTC 2014 Arguably point-free (or pointless, depending on one's point of view) programming in J must not use pro-words; that is, point-free programs in J are fixed tacit programs. Yet, some of us have used for many years a handy proprietary foreign verb (104!:8) for developing, testing and debugging tacit (to be fixed) programs; this verb reproduces its right argument but with a side-effect: It also assigns its right argument to the pro-word with the name specified by its left argument. (o=. @:) (k=. ] [ ;:@:[ 104!:8 L:_1 ]) (wl=. 104!:1) NB. Jx (Extended J) user-defined utilities (@:(] [ ;:@:[ 104!:8 L:_1 ]))(104!:1) 'N0 N1 N2' k 'N0 , ": N1 ^ N2... ' ; 0 1 2 ; __ ┌───────────────────┬─────┬──┐ │N0 , ": N1 ^ N2... │0 1 2│__│ └───────────────────┴─────┴──┘ N0 , ": N1 ^ N2 N0 , ": N1 ^ N2... _ 1 0 > If copulas were verbs, what would happen here? > > count=:77 > msg=:'count' > msg=:msg,': ',":count 'count' k 77 77 'msg' k 'count' count 'msg' k msg,': ',":count count: 77 msg count: 77 > Or, better yet: > > count=: count +1 'count' k count +1 78 count 78 > 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). "In theory there is no difference between theory and practice. In practice there is." Fantastically (or horridly, depending on one's point of view), the verb (104!:8) can effortlessly make assignments that were never envisioned, ('v0 a1 c2 N3' k (< o (?: <'wl') ;. _1)) '`^&-:`@:>`^:`0 1 2' ┌────┬───┬──┬─────┐ │^&-:│@:>│^:│0 1 2│ └────┴───┴──┴─────┘ v0 a1 c2 N3 N3 0 1 2 1 1.64872 2.71828 1.64872 2.28042 3.89285 > > 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 On Wed, Jun 11, 2014 at 9:19 AM, Dan Bron <[email protected]> wrote: > 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
