Thanks David. With your explanation I could get the same result without  @:

   f=: 13 :' ((+/ % #) , *:@:+:)y'
   f 1 2 3
2 4 16 36
   
   g=: 13 :' (+/y % # y) , *:+:y'
   g 1 2 3
2 4 16 36
   
   f
(+/ % #) , *:@:+:
   g
([: +/ ] % #) , [: *: +:
   
Linda 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David Lambert
Sent: Thursday, April 16, 2015 7:26 AM
To: programming
Subject: Re: [Jprogramming] Verb to string and Verb array

The conjunction @: turns u@:v into a single verb whereas u v alone represent
2 verbs.  Sticking @: into a train converts a hook into a fork, a fork into
an hook, and changes verb valence.  Let's examine your A and B proverbs.

    with_at=:(+/ % #) , *:@:+:
    sans_at=:(+/ % #) , *: +:
    with_at
(+/ % #) , *:@:+:
    sans_at
(+/ % #) (, *: +:)


Wow!
The with_at case guarantees squaring, the monadic definition of *: .
Without @: the *: appears as an even verb of a fork, hence dyadic, which is
"not and" with Boolean domain.  Thus domain error.

> Date: Thu, 16 Apr 2015 05:19:09 -0400
> From: "Linda Alvord"<[email protected]> 
> To:<[email protected]>
> Subject: Re: [Jprogramming] Verb to string and Verb array 
> Message-ID:<[email protected]>
> Content-Type: text/plain; charset=utf-8
>
> Why is @: necessary?
>
> (1 {A=:(+/ % #) , *:@:+:)  1 2 3
> 4
>     A
> (+/ % #) , *:@:+:
>     A 1 2 3
> 2 4 16 36
>     
>
>         (1 {B=:(+/ % #) , *:+:)  1 2 3
> |domain error
> |       (1{B=:(+/%#),*:+:)1 2 3
>     B
> (+/ % #) (, *: +:)
>     
> 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

Reply via email to