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

View file

@ -37,14 +37,6 @@
(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
; ;; compiled macro
; ;((macro? (car exp))
; ; ((car exp)
; ; exp
; ; rename
; ; compare?))
; (else
(let ((macro (assoc (car exp) defined-macros))) (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.
@ -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 a raw lambda (IE, exec using eval), try quoting it
(if (or (macro? (Cyc-get-cvar (cdr macro))) (if (or (macro? (Cyc-get-cvar (cdr macro)))
(procedure? (cdr macro))) (procedure? (cdr macro)))
; TODO: what about macros? (if (macro? (Cyc-get-cvar (cdr macro)))
exp exp
(list 'quote exp)) (list 'quote exp))
rename rename
compare?) compare?)
exp))));)) ;; TODO: error instead?? 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??