Thank you so much for that post, Raul. It greatly helps me bridge the
gulf between thinking-in-J and thinking-in-Haskell. My sense is that
you've gotten this right.

This looks like a solid step toward framing the legendary
(Haskell/category theory) "monad" in J, which is the topic by which I
was distracted into looking at that non-array language. Again, many
thanks.


Tracy

On Fri, Mar 13, 2009 at 8:36 AM, Raul Miller <[email protected]> wrote:
> 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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to