[racket] Constructors for sequences
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!