arcadia
arcadia copied to clipboard
deftem
I'm trying to run this code from anarki
(= templates2* (table))
(mac deftem2 (tem . fields)
(withs (name (carif tem) includes (if (acons tem) (cdr tem)))
`(= (templates2* ',name)
(+ (mappend templates2* ',(rev includes))
(list ,@(map (fn ((k v)) `(list ',k (fn () ,v)))
(pair fields)))))))
(deftem2 point2d x y)
and I'm getting
Syntax error : (fn ((k v)) (cons (quote list) (cons (cons (quote quote) (cons k (quote nil))) (cons (cons (quote fn) (cons (quote nil) (cons v (quote nil)))) (quote nil)))))
error in expression:
(deftem2 point2d x y)
But if I execute it in Try ARC it runs well
arc> (= templates2* (table))
#hash()
arc> (mac deftem2 (tem . fields)
(withs (name (carif tem) includes (if (acons tem) (cdr tem)))
`(= (templates2* ',name)
(+ (mappend templates2* ',(rev includes))
(list ,@(map (fn ((k v)) `(list ',k (fn () ,v)))
(pair fields)))))))
#(tagged mac #<procedure: deftem2>)
arc> (deftem2 point2d x y)
((x #<procedure: gs968>))
arc> (deftem2 '(point3d point2d) z)
((z #<procedure: gs972>))
arc>