I like adverbs fn and op for defining one-line functions and operations:
fn =: 3 : NB. for one-line monadic verbs = functions
'1%y' fn 5
0.2
op =: 4 : NB. for one-line dyadic verbs = operations
3 'x%y' op 4
0.75
You can read '1%y' fn as "1 divided by y function" and
'x%y' op as "x divided by y operation". The notation focuses
attention immediately on the calculation.
You can do
f =: ('1%y';':';'x%y') fn
f 5
0.2
3 f 4
0.75
but if your aim is easy comprehension,
f =: verb define
1%y
:
x%y
)
NB. that is,
f
3 : 0
1%y
:
x%y
)
is better.
Kip Murray
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm