Thanks to all. I got in trouble because I used a lousy example.
|.23
23
23|.23
23
I thought reverse instead of rotate . Instead p is just doing what it
is supposed to do.
p=:-:|.
p 'stresseddesserts'
1
I'm the one who is stressed.
Linda
-----Original Message
-----
From: [email protected]
[mailto:[email protected]] On Behalf Of km
Sent: Saturday, January 21, 2012 11:19 AM
To: Programming forum
Subject: Re: [Jprogramming] Morning exercise
You can sometimes vocalize hooks helpfully: (* %) is "times the reciprocal"
and (-: |.) is "matches the reverse". It must become instinctive to think
of the dyadic use of the first verb and the monadic use of the second.
Exercise. How are ([: f g) and ([ f g) different from (f g) ?
Kip
Sent from my iPad
On Jan 21, 2012, at 7:57 AM, "Ken Chakahwata"
<[email protected]> wrote:
> 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: [email protected]
> [mailto:[email protected]] 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 <[email protected]>
> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm