To chime in on this, there is Phrases page
http://www.jsoftware.com/jwiki/Phrases/Definitions
that allows to lay out definitions like this:
'Arithmetic' defn
add=: : x+y NB. addition
pow=: ^y : x ^ y NB. power
sqr=: y pow 2
sqrt=: y pow 0.5
)
It was inspired by APL defn mode. Note how it uses : introduce
dyadic and ambivalent verbs.
> From: Kip Murray <[EMAIL PROTECTED]>
>
> 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