The Lambda Lab
/
projects
/
scheme.forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
16fe102
)
quasiquote and unquote working.
author
Tim Vaughan
<tgvaughan@gmail.com>
Sat, 5 Nov 2016 05:50:07 +0000
(18:50 +1300)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Sat, 5 Nov 2016 05:50:07 +0000
(18:50 +1300)
scheme.4th
patch
|
blob
|
history
diff --git
a/scheme.4th
b/scheme.4th
index
5d3b778
..
69154f2
100644
(file)
--- a/
scheme.4th
+++ b/
scheme.4th
@@
-1082,24
+1082,32
@@
parse-idx-stack parse-idx-sp !
2drop car 2swap eval
;
2drop car 2swap eval
;
-: (eval-quasiquote) ( env obj -- res )
+defer eval-quasiquote-item
+: eval-quasiquote-list ( env obj -- res )
nil? if
2swap 2drop exit
then
nil? if
2swap 2drop exit
then
- 2over 2over
car ( env obj env obj-car
)
+ 2over 2over
( env obj env obj
)
- unquote? if
- eval-unquote
- else
- 2swap 2drop
- then
+ car eval-quasiquote-item ( env obj caritem )
- -2rot cdr ( caritem env cdr )
- recurse ( caritem cdritems )
+ -2rot cdr recurse ( caritem cdritems )
cons
;
cons
;
+:noname ( env obj )
+ unquote? if
+ eval-unquote exit
+ then
+
+ pair-type istype? if
+ eval-quasiquote-list exit
+ then
+
+ 2swap 2drop
+; is eval-quasiquote-item
+
: eval-quasiquote ( obj env -- res )
2swap cdr ( env args )
: eval-quasiquote ( obj env -- res )
2swap cdr ( env args )
@@
-1114,15
+1122,8
@@
parse-idx-stack parse-idx-sp !
2drop car ( env arg )
2drop car ( env arg )
- unquote? if
- eval-unquote exit
- then
-
- pair-type istype? if
- (eval-quasiquote) exit
- then
-
- 2swap 2drop ;
+ eval-quasiquote-item
+;
: variable? ( obj -- obj bool )
symbol-type istype? ;
: variable? ( obj -- obj bool )
symbol-type istype? ;