Hi guys,
I am wondering if there already exists a way of doing something that I
want, which is an elementary enough operation that I was quite surprised to
not have found it in jvoc/evoke gerund.
If I have some gerund say *:`+: I am looking for some function which will
apply the gerund's constituents in order (from right to left of course)
monadically to some noun.
For example '(*:`+:) f 4' should be equivalent to '*: +: 4' (which is 64)
My current solution is functional but unsatisfactory. Convert gerund to
string, append the (string) argument and then apply 'do' ".
composeGerund=:".@:((,@:(,"1&' ')@:>@:[) , ])
e.g:
gerund=:*:`+:
, ,"1&' ' >gerund
*: +:
(, ,"1&' ' >gerund) , '4'
*: +: 4
". (, ,"1&' ' >gerund) , '4'
64
I don't want to have to specify my right argument as a string, I want to
pass in variables by value!
Does anyone have a good solution?
Cheers,
Rob
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm