A critic of Guido's blog on Python's lambda
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Wed May 10 10:10:58 EDT 2006
Followup-To: comp.lang.lisp
Bill Atkins <NOatkinwSPAM at rpi.edu> writes:
> The cool thing about ITERATE is that it lets you express looping
> concepts in a language designed explicitly for such a purpose, e.g.
>
> (iter (for x in '(1 3 3))
> (summing x)) => 7
>
> (iter (for x in '(1 -3 2))
> (finding x maximizing (abs x))) => -3
>
> (iter (for x in '(a b c 1 d 3 e))
> (when (symbolp x)
> (collect x))) => (a b c d e)
While such macros indeed allow to generate efficient code, I don't
find these examples convincing in terms of readability. The same
examples in my language where iteration is based on higher order
functions are shorter and also clear:
Sum [1 3 3]
=> 7
[1 (-3) 2]->MaximumBy Abs
=> -3
[#a #b #c 1 #d 3 #e]->Select (_ %Is SYMBOL)
=> [#a #b #c #d #e]
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Python-list
mailing list