On Thu, Dec 9, 2010 at 8:15 PM, Marshall Lochbaum
<[email protected]> wrote:
> You want an adverb:
>
> gamma=: 1 : '] , u , u D. 1'
>
> produces the requested verb (],q, (q D. 1)) when called. Then if t is given
> to (q gamma), it will execute the fork and give you an array of your three
> values.
Another approach is to use a verb which takes a gerund argument
and returns a gerund result.
In other words:
GammaVerb=:3 :0
(y`:6 gamma)`''
)
Or:
GammaVerb=:3 :0
u=. y`:6
(] , u , u D. 1)`''
)
This winds up being more verbose than Marshall Lochbaum's gamma,
but if SICM is doing the sort of incremental accretion design approach
that LISP favors you are going to maybe need the ability to micro
manage that the verbose approach gives you.
Usage:
*: gamma i. 4
(GammaVerb *:`'')`:6 i. 4
(Note that D. gives you a rank 2 result for this case. If you
were using an example from SICM you probably wanted d.
instead?)
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm