I've been caught by the hook in the *present* (and I thought I understood
them!).
My go-to example for hooks is a dyadic function followed by a monadic one:
So for example, the monadic hook (+!) would be interpretted as argument +
!argument which gives a nice intuitive meaning to (+!) , viz. the argument
plus its factorial.

However, in the case cited by the OP, the first part of the hook pair is a
monadic function, since the LHS has already bound to 3.  So I would have
expected an error message, because I thought the first verb in a hook
/must/be dyadic.  Is this not the case?  Can you still prefix a left-hand
argument, say N, and expect the hook to be executed N times?  Wow!
Back to the desk... detention for not doing homework.


On 3 May 2014 00:23, Don Kelly <[email protected]> wrote:

> try func3=. [:(3&+) 2&-
> or
> func4=.3+2&-
>
> I've been caught by the hook in the past.
>
> Don Kelly+
>
>
> On 30/04/2014 8:42 AM, Jon Hough 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