Also worth keeping in mind might be:

http://www.jsoftware.com/pipermail/general/2006-January/026271.html

"With the hindsight from 17 years of usage, I would define 2-verb trains
differently ... "

but note also

http://www.jsoftware.com/pipermail/general/2006-January/026274.html

"There is no intention to replace the current hook. Its use seems too
embedded and too numerous and a change like that would be too disruptive."

Generally speaking: good documentation for code is often more important to
produce than the code itself, but businesses and educational institutions
both focus on the wrong metrics, thus undercutting their short and long
term success. J is actually incredibly good here, but of course it still
has significant room for improvement.

And, we get rough edges like this hook issue, which tend to create problems
and bafflement but where "fixing it" would make things worse (require far
more explanation about why all this great code fails).

It's something of a dilemma.

Thanks,

-- 
Raul



On Wed, Apr 30, 2014 at 12:12 PM, robert therriault
<[email protected]>wrote:

> Hi Jon,
>
> Like so many things in J, an added character usually does make a
> difference. That is the cost of using less to say more. :)
>
> In this case, I think that you have a pretty good handle on func1, so I
> will focus on what func2 is doing.
>
> func2 is a hook which means that func2 5 is acting like 5((3&+) (2&-)) 5
> because hooks (u v) y are the same as y( u v) y which is the same as y u (
> v y)
>
>  In your case func2 5 is like 5 (3&+) ((2&-) 5)  same as 5 (3&+) _3 . This
> is where things change up a bit because you are asking (3&+) to be executed
> on _3 a total of 5 times. In other  words add 3 to _3 five times and you
> have 15+_3 which is 12
>
> I see Ian has already given some good links for further reading. It does
> seem confusing at first, but it is consistent and does let you do some
> remarkable things when you get a feel for it.
>
> Cheers, bob
>
> On Apr 30, 2014, at 8:42 AM, Jon Hough <[email protected]> wrote:
>
> > I can't understand why
> > func1 =. 3&+ @: (2&-)
> > func2 =. (3&+) (2&-)
> >
> > give different results as mondaic verbs.
> > func1 5 gives 0, which is what I would expect.
> > func2 5 gives 12, which I can't understand.
> > I would like to know what the difference is between func1 and func2. It
> is my understanding that for monadic verbs @: is optional, so doesn't add
> anything to the meaning of the whole verb.
> > Regards.
> > ----------------------------------------------------------------------
> > 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

Reply via email to