Daniel Silva wrote:
We think dropping FILTER and MAP is pretty uncontroversial; (filter P
S) is almost always written clearer as a DO loop (plus the LAMBDA is
slower than the loop).  Even more so for (map F S).  In all cases,
writing the equivalent imperative program is clearly beneficial.

How about using srfi-42 instead of those nasty do loops? It's pretty clean: (list-ec (: a lis) (* a a)) is equivalent to (map (lambda (a) (* a a)) lis)

Before I discovered srfi-42, my code often had hideous things like:

(append-map
 (lambda (item)
   (map
    (lambda
        (inner)
      (* inner inner))
   (cdr item)))
 lis)

to return (1 4 9 16 25 36 49 64 81) for
a lis that's '((a 1 2 3) (b 4 5 6) (c 7 8 9))).

This becomes even neater:
(list-ec
 (: item lis)
 (: inner (cdr item))
 (* inner inner))

Have a happy first of april!
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to