Fixed a bug where cs was accessed out of bouds, gensyms, 'and and 'or are now macros
This commit is contained in:
@@ -25,6 +25,39 @@
|
||||
(define-syntax (mac a) (list + 1 1))
|
||||
(define-syntax (add . args) (pair '+ args))
|
||||
|
||||
(define-syntax (and . args)
|
||||
;; (and cond1 cond2 (cond3 args))
|
||||
;; ->
|
||||
;; (if cond1
|
||||
;; (if cond2
|
||||
;; (let ((g (cond3 args)))
|
||||
;; (if g
|
||||
;; g
|
||||
;; ()))
|
||||
;; ())
|
||||
;; ())
|
||||
(if args
|
||||
`(,if ,(first args)
|
||||
,(apply and (rest args))
|
||||
())
|
||||
t))
|
||||
|
||||
(define-syntax (or . args)
|
||||
;; (or cond1 cond2 (cond3 args))
|
||||
;; ->
|
||||
;; (if cond1
|
||||
;; t
|
||||
;; (if cond2
|
||||
;; t
|
||||
;; (if (cond3 args)
|
||||
;; t
|
||||
;; ())))
|
||||
(if args
|
||||
`(,if ,(first args)
|
||||
t
|
||||
,(apply or (rest args)))
|
||||
()))
|
||||
|
||||
(define-syntax (when condition . body)
|
||||
"Special form for when multiple actions should be done if a
|
||||
condition is true.
|
||||
|
||||
Reference in New Issue
Block a user