9!:3 [ 2 4 +&+&+: ┌───────┬─┬──┐ │┌─┬─┬─┐│&│+:│ ││+│&│+││ │ │ │└─┴─┴─┘│ │ │ └───────┴─┴──┘ ┌─ + ┌─ & ─┴─ + ── & ─┴─ +:
And looking at compose page ( http://www.jsoftware.com/help/dictionary/d630v.htm) we get (+: 2) +&+ (+: 3) I still don't understand the parsing rules enough to know how more complicated expressions/trains get parsed by J. Pardon if this is mere noise. On Sun, Mar 2, 2014 at 10:33 AM, Pascal Jasmin <godspiral2...@yahoo.ca>wrote: > That is indeed the problem, but the code > > 2 +&+&+: 3 > > > is not 2 + 2 +&+: 3 > > but rather > 0 + 2 +&+: 3 > 10 > when it should be: > + 2 +&+: 3 > 10 > > There doesn't seem to be a good reason to insert 0 v in it. This is weird > though: > > 2 ([: +: ])&(+&+:) 3 > 12 > > I don't think it is: > > 2+ 2 +&+:3 > > which seems to have nothing to do with supplied verbs. So more likely: > > +: (+ +: 3) > > and x argument is discarded completely. (it should have applied to 2 +&+: > 3, and above result should be 20) > > > ----- Original Message ----- > From: Don Guinn <dongu...@gmail.com> > To: Programming forum <programm...@jsoftware.com> > Cc: > Sent: Sunday, March 2, 2014 10:02:31 AM > Subject: Re: [Jprogramming] bug in & ? > > I think the problem is that the left-most +: is not-or and only accepts > boolean arguments. > > 0 +:&+&+: 0 > 1 > > > > On Sun, Mar 2, 2014 at 7:53 AM, Pascal Jasmin <godspiral2...@yahoo.ca > >wrote: > > > +:&+&+: 3 > > 12 > > 2 +&+&+: 3 > > 10 > > > > > > 2 +:&+&+: 3 > > |domain error > > | 2 +:&+&+:3 > > > > > > The 3rd verb (leftmost) is called dyadically (with 0 element? like /?) > > even though it sees only a monadic expression. > > ---------------------------------------------------------------------- > > 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