]> gitweb.factorcode.org Git - factor.git/commitdiff
Implementing quasiquotes for lisp
authorJames Cash <james.nvc@gmail.com>
Thu, 5 Jun 2008 08:14:26 +0000 (04:14 -0400)
committerJames Cash <james.nvc@gmail.com>
Thu, 5 Jun 2008 08:16:34 +0000 (04:16 -0400)
extra/lisp/lisp.factor

index 00d7b3cf9574779e78496757172e287e0a341591..6193c3b33ec640171684aea80d07e393de8b626c 100644 (file)
@@ -16,7 +16,7 @@ DEFER: macro-call
 ! Functions to convert s-exps to quotations
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 : convert-body ( cons -- quot )
-    [ ] [ convert-form compose ] lreduce ; inline
+    [ ] [ convert-form compose ] foldl ; inline
   
 : convert-if ( cons -- quot )
     cdr 3car [ convert-form ] tri@ '[ @ , , if ] ;
@@ -64,7 +64,8 @@ PRIVATE>
     "unquote not valid outside of quasiquote!" throw ;
     
 : convert-quasiquoted ( cons -- newcons )
-    [  ] traverse ;
+    [ { [ dup list? ] [ car dup lisp-symbol? ] [ name>> "unquote" equal? dup ] } && nip ]
+    [ cadr ] traverse ;
     
 : form-dispatch ( lisp-symbol -- quot )
     name>>