David Lambert:
>
> Dyad=: [: :
> add=: +&:([ 'x add y yields the sum x + y'"_) Dyad

Unlike +, the "add" has ranks _ _ which will be noticable with enough
context:

   1 <@add i. 4
+-------+
|1 2 3 4|
+-------+
   1 <@+   i. 4
+-+-+-+-+
|1|2|3|4|
+-+-+-+-+

Given that that you are ditching the monadic case anyway here,
it's simpler (and rank-preserving) to use u:v here:

   add =. 'x add y yields the sum x + y'"_ : +

or, with your Dyad-style protection against misuse:

   add =. [:&'x add y yields the sum x + y' : +

                                                        Martin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to