Oops, good point - I had a typographical error there. My apologies for
not thinking this through.

Here's a fixed version, with example arguments.

(3 :0) 2 3
   'x y'=. y
   x + y
)
5

Multi-line statements, like this one, tend to be clumsy,
interactively, but that does not mean that they do not work.

You could use ('x y')=. y but those parenthesis serve no mechanical
purpose. (The parenthesized form is to force J to use a variable's
value rather than its name, and that's not relevant here, especially
since x is undefined and y is a noun.) If you like the emphasis they
confer, you can include them - but you also need the quotes.

Thanks,

-- 
Raul


On Mon, Feb 2, 2015 at 9:56 AM, Joe Bogner <[email protected]> wrote:
> On Mon, Feb 2, 2015 at 9:10 AM, Raul Miller <[email protected]> wrote:
>
>> Here's one example of a J lambda syntax:
>>
>> 3 :0
>>   (x y)=. y
>>   x+y
>> )
>>
>> This differs from Haskell and Scheme lambda syntax in obvious ways,
>> but it's viable.
>>
>
> How would this get called / invoked?
>
> Using the scheme example[1]:
>
> (((lambda (x)
>   (lambda(y)
>      (+ x y))) 1) 2)
>
> 3
>
> Using the haskell example[2]:
>
> λ (\x y -> x+y)(1)(2)
> 3
>
> How would I use the J example?
>
> [1] - http://tryscheme.sourceforge.net/
> [2] - https://tryhaskell.org/
> ----------------------------------------------------------------------
> 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