fix macro

This commit is contained in:
yoyo
2024-09-10 19:53:28 +09:00
parent 2ddcc7578c
commit f467712907
5 changed files with 79 additions and 78 deletions

View File

@@ -3,12 +3,6 @@
(defun list (x . y) (cons x y))
(macro and (expr . rest)
(if rest (list 'if expr (cons 'and rest)) expr))
(macro cond (expr. rest)
(if rest (list 'if (car expr) (car (cdr expr)) (cons 'cond rest))
expr))
;exampe (cond ((== 1 0) 0) ((== 1 1) -1) (+ 100000000))
;exampe (cond ((== 1 0) 0) ((== 1 0) -1) (+ 100000000))
(macro cond (expr . rest)
(if (not expr) nil
`(if ,(car expr) (progn ,@expr) (cond ,@rest))))