+/@(sin,cos,tan) or +/@(sin,cos,:tan) gets you (sin+cos+tan). */@(sin,cos,tan) or */@(sin,cos,:tan) gets you (sin*cos*tan). etc.
See also >@(f&.>/)@(sin,&.>cos,&.>tan) ----- Original Message ----- From: Alex Gian <[email protected]> Date: Friday, December 3, 2010 3:00 Subject: [Jprogramming] Generic operations on verbs To: Programming forum <[email protected]> > As a j newb, I love the way rl evaluation and forks allow me to write > something like: > (sin + cos + tan) NB. OK, OK, (1&o. + 2&o. + > 3&o.) if you must! > > What I am looking for now, though is something equivalent to > insert (/) > at a higher level, so that - say - (*/ verb1 verb2 > verb3) > would give (verb1 * verb2 * verb3) > Now I realise that the above depiction is nonsense in j and that > all the > verbs would probably have to be 'tied' into a gerund or > something, but I > think you get the idea of what I am looking for: > > A way to apply an arbitrary (dyadic) operation on arbitrary (monadic) > verbs, in such a way that I get an extended fork. > I could code it recursively I suppose, but I am looking for > something a > little more elegant and j-like. > > Any suggestions appreciated. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
