This commit is contained in:
Justin Ethier 2015-08-18 21:59:12 -04:00
parent 5abd750697
commit 322696e4c1

View file

@ -37,15 +37,7 @@
(compare? (lambda (sym-a sym-b) ;; TODO: the compare function from exrename. (compare? (lambda (sym-a sym-b) ;; TODO: the compare function from exrename.
(eq? sym-a sym-b))) ;; this may need to be more sophisticated (eq? sym-a sym-b))) ;; this may need to be more sophisticated
) )
;(cond (let ((macro (assoc (car exp) defined-macros)))
; ;; compiled macro
; ;((macro? (car exp))
; ; ((car exp)
; ; exp
; ; rename
; ; compare?))
; (else
(let ((macro (assoc (car exp) defined-macros)))
;TODO: restructure this to use eval if the macro is not a proc. ;TODO: restructure this to use eval if the macro is not a proc.
; then can try passing in an environment with create-environment. ; then can try passing in an environment with create-environment.
@ -58,19 +50,20 @@
; (macro? (Cyc-get-cvar (cdr macro))))) ; (macro? (Cyc-get-cvar (cdr macro)))))
;(display " */") ;(display " */")
;; assumes ER macro ;; Invoke ER macro
(if macro (if macro
((Cyc-get-cvar (cdr macro)) ((Cyc-get-cvar (cdr macro))
;exp ;; Pass expression differently depending upon if this is a
; could be a raw lambda, if that is the case try quoting it ;; compiled macro or a cons one that will be called via eval.
(if (or (macro? (Cyc-get-cvar (cdr macro))) ;;
(procedure? (cdr macro))) ;; If a raw lambda (IE, exec using eval), try quoting it
; TODO: what about macros? (if (macro? (Cyc-get-cvar (cdr macro))) (if (or (macro? (Cyc-get-cvar (cdr macro)))
exp (procedure? (cdr macro)))
(list 'quote exp)) exp
rename (list 'quote exp))
compare?) rename
exp))));)) ;; TODO: error instead?? compare?)
exp)))) ;; TODO: error instead??
; TODO: get macro name, transformer ; TODO: get macro name, transformer
; TODO: base off of syntactic closures instead of ER macros?? ; TODO: base off of syntactic closures instead of ER macros??