dictionary page for f. mentions "problems" with f. when u includes $:

this example seems ok though:

 + 1 : ' 0 & $: : (u/ % #) f.'

0&$: :(+/ % #)

cut f.

' '&$: :([: -.&a: <;._2@,~)

but:

, 1 : ' u@cut f.'

,@(' '&$: :([: -.&a: <;._2@,~) (1 : 0))

u y

:

x u y

)

adds some "explicit boilerplate"

n&$: is an extremely useful pattern for providing default x argument to dyad.


I still passionately hate the new AC train interpretation.  (should be uACv 
instead of uACu), but it does offer an elegant-ish workaround.

([: -.&a: <;._2@,~) ((' '&) :)

' '&([: -.&a: <;._2@,~) :([: -.&a: <;._2@,~)

that should be faster as well in that $: is an extra call that probably 
includes edge cases that interfere with f.

An even more elegant workaround though is:

mdef =: 2 : 'n&u : u'  NB. monad default parameter n to dyad u

cut =: ([: -.&a: <;._2@,~) mdef ' '  NB. same result as tacit AC modifier above.


"explicit junk boilerplate" now removed.

, 1 : ' u@cut f.'

,@(' '&([: -.&a: <;._2@,~) :([: -.&a: <;._2@,~))
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to