I have found it easier to remember hook by considering it as special case of
a fork, with an appropriate identity function: i.e.

   (f g) y <=>  (] f g) y <=> (] y) f (g y)

Rgds
Ken

-----Original Message-----
From: programming-boun...@jsoftware.com
[mailto:programming-boun...@jsoftware.com] On Behalf Of Marc Simpson
Sent: 21 January 2012 10:57
To: Programming forum
Subject: Re: [Jprogramming] Morning exercise

On Sat, Jan 21, 2012 at 9:39 AM, Linda Alvord <lindaalv...@verizon.net>
wrote:
>
> Are there rules for specific verbs to behave differently when they are
next
> to each other?

I'm not sure that I understand the question-you're demonstrating hooks
in the above; given your definitions,

   p=: -:|.
   n=: *%

the left hand verb in the train (hook) will be called in a dyadic
context. In other words,

   (f g) y <=> y f (g y)

as such, you're not using halve in 'p' or signum in 'n'; rather, match
and times. Perhaps this clarifies things,

   p 23
1
   (-: |.) 23
1
   23 (-: |.) 23
1
   23 -: |. 23
1
   23 -: (|. 23)
1

Similarly for n,

   n 23
1
   (* %) 23
1
   23 (* %) 23
1
   23 * (% 23)
1

Best,
M
----------------------------------------------------------------------
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