Code: Select all
(context 'gensym)
(set 'no 0)
(define (gensym:gensym)
"creates lots of unique symbols ... is that enough?"
(sym (string "___" (inc 'no 0.1))))
(context MAIN)
Code: Select all
(define-macro (def-macro)
"creates macro definitions with automatically created symbols"
(let ((__def-macro_def (clean (fn (x) (= ', x)) (rest (args 0))))
(__def-macro_sym '()))
(dolist (__def-macro_ __def-macro_def)
(push (list __def-macro_ (gensym)) __def-macro_sym))
(set '__def-macro_def (expand (args) __def-macro_sym))
(push 'define-macro __def-macro_def)
(eval __def-macro_def)
)
)
Comments are highly appreciated.
Ingo