Post Scarcity
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
defun.lisp
Go to the documentation of this file.
1(set! symbolp (lambda (x) (equal (type x) "SYMB")))
2
3(set! defun!
4 (nlambda
5 form
6 (cond ((symbolp (car form))
7 (set (car form) (apply 'lambda (cdr form))))
8 (t nil))))
9
10(set! defun!
11 (nlambda
12 form
13 (eval (list 'set! (car form) (cons 'lambda (cdr form))))))
14
15(defun! square (x) (* x x))
16
17(set! defsp!
18 (nlambda
19 form
20 (cond (symbolp (car form))
21 (set! (car form) (apply nlambda (cdr form))))))
22
23(defsp! cube (x) ((* x x x)))
24
25(set! p 5)
26
27(square 5) ;; should work
28
29(square p) ;; should work
30
31(cube 5) ;; should work
32
33(cube p) ;; should fail: unbound symbol