eval =: 1 : ' a: 1 : m' A =: 1 : (,'u') eval2ger =: 3 : 'a=. A for_i. y do. a=. (>i) eval a ` end. '''' a'
a partial way of doing it, (eval2ger@:((<' f.') ,~ each ]) 'increment';'result')@.choose f. ([: $: >:)`]@.(3 < |) eval2ger takes a boxed list of string expressions, and turns them into a gerund expression. The other part "automates" adding f. inside the expression. ________________________________ From: David Lambert <[email protected]> To: programming <[email protected]> Sent: Tuesday, July 29, 2014 10:05:54 PM Subject: [Jprogramming] recursive agenda with named components Suppose I have a recursive verb ([: $: >:)`]@.(3 < |) And I want to name the components increment =: [: $: >: result =: ] choose =: 3 < | increment`[email protected] f. 3 : '[: $: >: y' :(4 : 'x [: $: >: y')`]@.(3 < |) J carefully isolated recursion to the named verb Thus I really want to, in symbolic language, Map f. (increment f.)`(result f.)@.(choose f.) ([: $: >:)`]@.(3 < |) Or in this case, simply (increment f.)`[email protected] f. ([: $: >:)`]@.(3 < |) Is there a way to map f. ? I tried literals with Define (5!:0) but of course I'd need to construct a complicated boxed structure. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
