update sugar/list
parent
ac469d6d3f
commit
f9a68d0ae1
@ -1,32 +0,0 @@
|
||||
#lang racket/base
|
||||
(require (for-syntax racket/base))
|
||||
(require racket/syntax)
|
||||
|
||||
(provide define->macro)
|
||||
|
||||
|
||||
(define-syntax define->macro
|
||||
(syntax-rules ()
|
||||
[(_ (proc-name arg ... . rest-arg) proc-expr ...) (define->macro proc-name (λ(arg ... . rest-arg) proc-expr ...))]
|
||||
[(_ proc-name proc) (define-syntax proc-name
|
||||
(syntax-id-rules ()
|
||||
[(proc-name expr (... ...)) (proc expr (... ...))]
|
||||
[proc-name proc]))]))
|
||||
|
||||
|
||||
;(define foo (λ(x) (add1 x)))
|
||||
;(define->macro foo (λ(x) (add1 x)))
|
||||
|
||||
;(foo 4)
|
||||
;(map foo '(2 4 6))
|
||||
|
||||
;(define (bar x) (add1 x))
|
||||
;(define->macro (bar x y) (+ x y))
|
||||
|
||||
;(bar 4 1)
|
||||
;(map bar '(2 4 6) '(2 4 6))
|
||||
|
||||
;(define-syntax zam (add1 x))
|
||||
|
||||
;(zam 4)
|
||||
;(map zam '(2 4 6))
|
Loading…
Reference in New Issue