[racket] Constructors for sequences

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Apr 30 17:57:12 EDT 2012

Yesterday, Galler wrote:
> 
> try this:
> 
> (require mzlib/defmacro)
> 
> (define-macro (distribute . (f g . rest))
>     `(,g ,@(map (λ (x) `(,f  ,x)) rest)))

Off-topic, but it bugs me to see posted examples that use
`define-macro'...  Note that using plain macros is not only more
robust, it's also much easier to read and to write.  Following the
above macro is IMO much harder than following this:

  (define-syntax-rule (distribute f g x ...) (g (f x) ...))

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.