[Jprogramming] Morning exercise
Ken Chakahwata
kmchakahwata at first-derivative.com
Sat Jan 21 21:57:03 HKT 2012
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-bounces at jsoftware.com
[mailto:programming-bounces at 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 <lindaalvord at 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
More information about the Programming
mailing list