[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LFM + LFSP = LFE?




> Date: Mon, 16 Jun 2003 21:46:34 +0200 (MEST)
> From: Robert Feldt <feldt@ce.chalmers.se>
> 
> On Sun, 15 Jun 2003, Michael Vanier wrote:
> 
> > -- both the do...end and { } notation for function bodies
> >
> Yes, I see no big need although practice is to use the latter for
> one-liners (array.map {|e| ...}) while do...end is reserved for more
> complex, multi-line bodies.
> 

One thing I should add here: python's indentation-based syntax loses big
time when you want to have inline lambda expressions, simply because you
can't do this:

all_same = reduce(lambda x, y:
                      if x == y:
                          return 1
                      else:
                          return 0,
                  [1, 1, 1, 1, 1])

At least, it didn't the last time I checked ;-)

OTOH this is no problem for scheme or ruby.  Not that this is earth-shaking
anyway, but I think it's a good argument against indentation-based syntax
(which I like most of the time).

Mike