List Info

Thread: Re: lambda with normal block syntax




Re: lambda with normal block syntax
user name
2008-05-26 11:41:55
On May 26, 2008, at 11:31 AM, Yukihiro Matsumoto wrote:

> |reads better to me, as does
> |
> |   twotimes = fn x -> { 2 * x }
> |
> |as does
> |
> |   twotimes = $B&K(B x -> { 2 * x }
>
> Interesting.  What is the rationale for having both
prefix  
> (fn or $B&K(B)
> and -> symbol?  Honoring functional languages
tradition?  I prefer
> incomplete assignment model described in the prior
post.

Partly that, and partly because I wondered if the delimiter
made  
parsing easier. If not, then I'd be very happy with losing
the -> 

>
>
> |In fact, given a change that allows block arguments to
be like method
> |arguments, then maybe no other change is needed. We
can always alias
> |lambda to something shorter, and then everyone is
happy
> |
> |   n_times = $B&K(B { |n=2|   $B&K(B
{|val| n*val}}
>
> In that case, default values patch for block parameters
are must.

and block params?



Dave


Re: lambda with normal block syntax
user name
2008-05-26 12:10:59
Hi,

In message "Re: [PATCH] lambda with normal block
syntax"
    on Tue, 27 May 2008 01:41:55 +0900, Dave Thomas
<davepragprog.com> writes:

|> |   twotimes = $B&K(B x -> { 2 * x }
|>
|> Interesting.  What is the rationale for having both
prefix  
|> (fn or $B&K(B)
|> and -> symbol?  Honoring functional languages
tradition?  I prefer
|> incomplete assignment model described in the prior
post.
|
|Partly that, and partly because I wondered if the delimiter
made  
|parsing easier. If not, then I'd be very happy with losing
the -> 

If fn or $B&K(B is a keyword.  In fact, it's just
replacing -> by that
keyword (or symbol) internally.

|> In that case, default values patch for block
parameters are must.
|
|and block params?

Yes, but it's already in.

							matz.


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )