> oper =: 1 : '_2&}. , _2&{ u {:'
In this case, I think an explicit definition is best. It's most readable, and
there's nothing to be gained by going tacit (though
I view tacit code as its own end).
But, for the sake of exposition, you could write your adverb tacitly using some
of the techniques demonstrated in this thread.
First, I would like to change your definition a bit. This:
oper_explct =: 1 : '_2&(}. , u/@:{.)'
will still work when the stack's depth is < 2 . It also uses the "split
idiom", which makes it clearer how to generalize.
Onward, then.
oper_tacit0 =: / (@:{.) (,`) (}.`) (`:6) (_2&) NB. Yuck!
oper_tacit1 =: _2&(}. , $:/@:{.) :
+ oper_explct
_2&(}. , +/@:{.)
+ oper_tacit0
_2&(}. , +/@:{.)
+ oper_tacit1
_2&(}. , $:/@:{.) :+
swap =: ,~
swap oper_tacit1 swap oper_tacit0 swap oper_explct 1 2 3
1 3 2
Hope this helps,
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm