[Jprogramming] Verb to string and Verb array
Linda Alvord
lindaalvord at verizon.net
Fri Apr 17 05:49:07 UTC 2015
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: programming-bounces at forums.jsoftware.com
[mailto:programming-bounces at forums.jsoftware.com] 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"<lindaalvord at verizon.net>
> To:<programming at jsoftware.com>
> Subject: Re: [Jprogramming] Verb to string and Verb array
> Message-ID:<000c01d07826$68500770$38f01650$@verizon.net>
> 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
More information about the Programming
mailing list