You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sugar/macro.rkt

21 lines
420 B
Racket

11 years ago
#lang racket/base
(require (for-syntax racket/base))
(provide macro-map)
(define-syntax (macro-map stx)
(syntax-case stx ()
11 years ago
[(_ macro-name (list item0))
11 years ago
#'(cons
11 years ago
(macro-name item0) '())]
[(_ macro-name (list item0 items ...))
#'(cons
(macro-name item0)
(macro-map macro-name (list items ...)))]))
(define-syntax-rule (add x)
(+ 1 x))
(macro-map add (list 24 25 30))