Progress, but there's something wrong with nlambdas

This commit is contained in:
Simon Brooke 2018-12-13 23:20:34 +00:00
parent 11409301da
commit cec32eff54
12 changed files with 288 additions and 204 deletions

View file

@ -2,17 +2,18 @@
;; to defun as a list of sexprs.
(set! defun!
(nlambda
(name args body)
(cond (symbolp name)
(set! name (apply lambda (cons args body))))))
form
(cond ((symbolp (car form))
(set! (car form) (apply lambda (cdr form)))))
(t nil)))
(defun! square (x) ((* x x)))
(defun! square (x) (* x x))
(set! defsp!
(nlambda
(name args body)
(cond (symbolp name)
(set! name (nlambda args body)))))
form
(cond (symbolp (car form))
(set! (car form) (apply nlambda (cdr form))))))
(defsp! cube (x) ((* x x x)))

4
lisp/fact.lisp Normal file
View file

@ -0,0 +1,4 @@
(set! fact
(lambda (n)
(cond ((= n 1) 1)
(true (* n (fact (- n 1)))))))