On Thu, Mar 12, 2009 at 1:57 PM, Tracy Harms <[email protected]> wrote:
> If I understand &&& to some degree, it not only receives two functions
> as arguments but results in two distinct function-results.
Perhaps &&& could be modeled like this?
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.
)
andandand=: 2 :0
U=. u serialized
V=. v serialized
monad=. '(',U,' y) u ',V,' y'
dyad=. '(x ',U,' y) u x ',V,' y'
1 : (monad;':';dyad)
)
% +/ andandand # 2 3 5
3.33333
In other words:
% +/ andandand #
% (1 : 0)
((+/) y) u (#) y
:
(x (+/) y) u x (#) y
)
This would not be a natural mode of expression for a J user, but seems
to fit what I understand of how people use Haskell. (Except that,
also, haskell's operators use different syntax.)
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm