projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/lisp: Evaluate macros once, then smash them into place
[fw/altos]
/
src
/
lisp
/
ao_lisp_const.lisp
diff --git
a/src/lisp/ao_lisp_const.lisp
b/src/lisp/ao_lisp_const.lisp
index c6f50e346c9dd8bb61fcbc12eee7c6525af1ea23..9d8af58862e1af43a7fb1c21fe005999cf56178a 100644
(file)
--- a/
src/lisp/ao_lisp_const.lisp
+++ b/
src/lisp/ao_lisp_const.lisp
@@
-9,10
+9,6
@@
;(setq progn (lexpr (l) (last l)))
;(setq progn (lexpr (l) (last l)))
- ; simple math operators
-
-(setq 1+ (lambda (x) (+ x 1)))
-(setq 1- (lambda (x) (- x 1)))
;
; Define a variable without returning the value
;
; Define a variable without returning the value
@@
-64,7
+60,7
@@
; make the list of names in the let
;
; make the list of names in the let
;
- (set
'
make-names (lambda (vars)
+ (set
q
make-names (lambda (vars)
(cond (vars
(cons (car (car vars))
(make-names (cdr vars))))
(cond (vars
(cons (car (car vars))
(make-names (cdr vars))))
@@
-77,7
+73,7
@@
; pre-pended to the
; expressions to evaluate
;
; pre-pended to the
; expressions to evaluate
;
- (set
'
make-exprs (lambda (vars exprs)
+ (set
q
make-exprs (lambda (vars exprs)
(progn
(cond (vars (cons
(list set
(progn
(cond (vars (cons
(list set
@@
-94,13
+90,13
@@
)
)
)
)
)
)
- (set
'
exprs (make-exprs vars exprs))
+ (set
q
exprs (make-exprs vars exprs))
;
; the parameters to the lambda is a list
; of nils of the right length
;
;
; the parameters to the lambda is a list
; of nils of the right length
;
- (set
'
make-nils (lambda (vars)
+ (set
q
make-nils (lambda (vars)
(cond (vars (cons nil (make-nils (cdr vars))))
)
)
(cond (vars (cons nil (make-nils (cdr vars))))
)
)
@@
-108,7
+104,6
@@
;
; build the lambda.
;
;
; build the lambda.
;
- (set 'last-let-value
(cons
(list
'lambda
(cons
(list
'lambda
@@
-120,8
+115,6
@@
(make-nils vars)
)
)
(make-nils vars)
)
)
- )
-
)
(car let-param)
(cdr let-param)
)
(car let-param)
(cdr let-param)
@@
-158,3
+151,12
@@
)
)
)
)
)
)
+
+ ; simple math operators
+ ;
+ ; Do these last to run defun
+ ; at least once so the let macro
+ ; is resolved
+
+(defun 1+ (x) (+ x 1))
+(defun 1- (x) (- x 1))