From: Nate_Wiger@... Date: 2008-05-24T01:44:41+09:00 Subject: Re: lambda, ->, haskell, and so on This is a multipart message in MIME format. --=_alternative 005BFC8D88257452_= Content-Type: text/plain; charset="ISO-8859-2" Content-Transfer-Encoding: quoted-printable "Jeremy McAnally" wrote on 05/22/2008 05:35:01=20 PM: > 2008/5/22 Rados=B3aw Bu=B3at : > > > > This example comes from Ryan Bates railscasts > > (http://railscasts.com/episodes/108). > > In Ruby 1.9 it's easier with -> > > > > named=5Fscope :recent, ->(time =3D 2.weeks.ago) { {:conditions =3D> > > ["released=5Fat > ?", time]} } > > Even though I see the usefulness, that's just ugly. Agreed. If the || issue with lambda was fixed, couldn't that read: named=5Fscope :recent, lambda{|time =3D 2.weeks.ago| {:conditions =3D> ["released=5Fat > ?", time]} } There is only a 3-character difference in typing, but if that is too much, here are a couple 1-character options. # Use &func like Perl named=5Fscope :recent, &{|time =3D 2.weeks.ago| {:conditions =3D> ["released=5Fat > ?", time]} } # Use \{}=20 named=5Fscope :recent, \{|time =3D 2.weeks.ago| {:conditions =3D> ["released=5Fat > ?", time]} } =20 # Use coupled {{ }}=20 named=5Fscope :recent, {{|time =3D 2.weeks.ago| {:conditions =3D> ["released=5Fat > ?", time]} }} Nate Wiger PlayStation --=_alternative 005BFC8D88257452_= Content-Type: text/html; charset="ISO-8859-2" Content-Transfer-Encoding: quoted-printable
"Jeremy McAnally" <jeremymcanally@gmail= .com> wrote on 05/22/2008 05:35:01 PM:
> 2008/5/22 Rados=B3aw Bu=B3at <radek.bulat@gmail.com>:
> >

> > This example comes from Ryan Bates railsca= sts
> > (http://railscasts.com/episodes/108).
> > In Ruby 1.9 it's easier with ->
> >
> > named=5Fscope :recent, ->(time =3D 2.weeks.ago) { {:conditions =3D>
> >   ["released=5Fat > ?", time]} }
>

> Even though I see the usefulness, that's just ugly.

Agreed. If the || issue with lambda was fixed, could= n't that read:

   named=5Fscope :recent, lambda{|time =3D= 2.weeks.ago| {:conditions =3D>
    ["released=5Fat > ?", time]} }

There is only a 3-character difference in typing, but if that is too
much, here are a couple 1-character options.<= /tt>

   # Use &func like Perl
   named=5Fscope :recent, &{|time =3D = 2.weeks.ago| {:conditions =3D>
    ["released=5Fat > ?", time]} }

   # Use \{}
   named=5Fscope :recent, \{|time =3D 2.we= eks.ago| {:conditions =3D>
    ["released=5Fat > ?", time]} }
 

   # Use coupled {{ }}
   named=5Fscope :recent, {{|time =3D 2.we= eks.ago| {:conditions =3D>
    ["released=5Fat > ?", time]} }}



Nate Wiger
PlayStation
--=_alternative 005BFC8D88257452_=--