No, I do not have an explicit version of mu (I do not even remember when
was the last time I coded explicitly).
Setting default values can be handy!
I use definitions similar to your X and Y:
f
&({::)
x
@:[
y
@:]
1 f x * 0 f y + 1 f y - 0 f x
1&({::)@:[ * 0&({::)@:] + 1&({::)@:] - 0&({::)@:[
On Mon, Feb 16, 2015 at 3:34 PM, 'Pascal Jasmin' via Programming <
[email protected]> wrote:
> looks cool, do you have an explicit version of mu?
>
> An alternative parameterization technique for explicit functions (much
> less cool)
>
> defined from here:
> http://www.jsoftware.com/jwiki/PascalJasmin/decorators%20in%20J
>
> as Par
> 3 : ('a+b+c' Par 'a b c')
> 3 : 0
> 'a b c'=. y defaults fixlenx (0$0);(0$0);0$0
> a+b+c
> )
>
> 3 : ('a+b+c' Par 'a b c') 1 2 3
> 6
>
>
> The extra code line permits setting default values for each parameter. So:
>
> 3 : ('a+b+c' Par 'a b c'; 2;4;5)
> 3 : 0
> 'a b c'=. y defaults fixlenx 2;4;5
> a+b+c
> )
>
>
>
> 3 : ('a+b+c' Par 'a b c'; 2;4;5) 1 2 3
> 6
>
> 3 : ('a+b+c' Par 'a b c'; 2;4;5) a:
> 11
>
>
> 3 : ('a+b+c' Par 'a b c'; 2;4;5) '';3;''
> 10
>
>
> For tacit parameters, I really like the simple 2:
>
>
> Y =: (&{::)(@:])
> X =: (&{::)(@:[)
>
> 3 2 (1 X * 0 Y + 1 Y - 0 X ) 1;32
> NB. cuts a lot of noise out of expressions, and flexible to boxed vs
> unboxed.
>
> (1 X * 0 Y + 1 Y - 0 X )
> 1&({::)@:[ * 0&({::)@:] + 1&({::)@:] - 0&({::)@:[
>
>
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm