Progress, but there's something wrong with nlambdas
This commit is contained in:
parent
11409301da
commit
cec32eff54
12 changed files with 288 additions and 204 deletions
|
|
@ -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
4
lisp/fact.lisp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(set! fact
|
||||
(lambda (n)
|
||||
(cond ((= n 1) 1)
|
||||
(true (* n (fact (- n 1)))))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue