Hi Linda,

   j NB. Even though j returns f g, it is really (f g) which is a hook and is 
not the same as f g A
f g
   j=: 13 :'(f g)y'
   f=:<
   g=:+/"1
   A=:i.2 2
   j A
1 0
1 1
   (f g) A
1 0
1 1
   A f g A NB. (f g) n <=> n f (g n)
1 0
1 1
  f g A NB. I am guessing that this is what you were expecting?
┌───┐
│1 5│
└───┘

Seasons Greetings, bob


> On Dec 25, 2015, at 8:35 AM, Linda A Alvord <[email protected]> wrote:
> 
> I found my  mistake just then. A should be y.  However, I still do not 
> understand how it gets the result shown:
> 
> 
>   j=: 13 :'(f g)y'
>   j
> f g
>   j A
> 1 0
> 1 1
> 
> Linda
> 
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Linda A Alvord
> Sent: Friday, December 25, 2015 11:30 AM
> To: [email protected]
> Subject: Re: [Jprogramming] A result I don't understand
> 
> I mean j   (the message escaped  when I was making a change)
>   j=: 13 :'(f g)A'
>   j
> (2 2$1 0 1 1)"_
>   j A
> 1 0
> 1 1
> 
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Linda A Alvord
> Sent: Friday, December 25, 2015 11:25 AM
> To: [email protected]
> Subject: Re: [Jprogramming] A result I don't understand
> 
> I don't understand how 
> 
>    (f g) A
> 1 0
> 1 1
> 
> Where are the verbs f and g when you display the definition of I ?
> 
> Linda
> 
> What is it doing to make this result?
> 
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Raul Miller
> Sent: Friday, December 25, 2015 9:23 AM
> To: Programming forum
> Subject: Re: [Jprogramming] A result I don't understand
> 
> I do not understand your question.
> 
> Are you asking why a hook is different from some other form of composition?
> 
> Thanks,
> 
> -- 
> Raul
> 
> 
> On Fri, Dec 25, 2015 at 7:45 AM, Linda A Alvord <[email protected]> 
> wrote:
>> Extending an example on composition from Sykes's LJ,  I made the final step.
>> What's happening here?
>> 
>> 
>> 
>>   A=:i.2 2
>> 
>>   f=:<
>> 
>>   g=:+/"1
>> 
>>   f @ g A
>> 
>> --T-┐
>> │1│5│
>> L-+--
>> 
>>   f & g A
>> 
>> --T-┐
>> │1│5│
>> L-+--
>> 
>>   f"0 g A
>> 
>> --T-┐
>> │1│5│
>> L-+--
>> 
>> 
>> 
>>   f @: g A
>> 
>> ----┐
>> │1 5│
>> L----
>> 
>>   f &: g A
>> 
>> ----┐
>> │1 5│
>> L----
>> 
>>   f g A
>> 
>> ----┐
>> │1 5│
>> L----
>> 
>> 
>> 
>>   (f g) A
>> 
>> 1 0
>> 1 1
>> 
>> 
>> 
>> 
>> 
>>   h=: 13 :'f"0 g y'
>> 
>>   h A
>> 
>> --T-┐
>> │1│5│
>> L-+--
>> 
>>   i=: 13 :'f g y'
>> 
>>   i A
>> 
>> ----┐
>> │1 5│
>> L----
>> 
>>   j=: 13 :'(f g)A'
>> 
>>   j A
>> 
>> 1 0
>> 1 1
>> 
>> 
>> 
>> Linda
>> 
>> ----------------------------------------------------------------------
>> 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
> 
> ----------------------------------------------------------------------
> 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