On Wed, Mar 11, 2009 at 3:04 PM, Tracy Harms <[email protected]> wrote:
> CE:  if "fork" weren't already in J, could you define it and use it
> conveniently?
>
> TH:  No. J's verb trains (e.g. fork) allow separation-and-rejoining to
> be put in terms of functions, not structures of resulting values.
>
> My question to the J forum is: Have I erred or overlooked anything?

In other words, can we perform
   (+/ % #)2 3 5
3.33333

without using verb trains?

I think we can:

serialized=: 1 :0
   r=. 5!:5<'u'
   if. 10 41-:a.i._2{.r do.
      '((3!:2 a.{~',(":a.i.3!:1]5!:1<'u'),')5!:0)'
   else.
      '(',r,')'
   end.
)

fork=: 1 :0
   w=. u serialized
   monad=. '(u y) ',w,' v y'
   dyad=.  '(x u y) ',w,' x v y'
   2 : (monad;':';dyad)
)

   +/ %fork # 2 3 5
3.33333

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to