I'm trying to write a macro that takes in an id, and creates a variable with a name based on id, and adds a string based on id into a list.
If I have (define-filter-category foo), I want it to add "CICategoryFoo" to the FILTER-CATEGORIES list as well as introduce a binding for the variable filter-category-foo. I have the part that adds the string to the list, but I do not know how to manipulate the id and introduce the variable. Can anyone shed some light on this for me? Thanks What I have so far: (define FILTER-CATEGORIES empty) (define (id->category-string n) (define (camel-case str) (regexp-replace* #rx"-" (string-titlecase str) "")) (string-append "CICategory" (camel-case (symbol->string n)))) (define (id->category-id n) (string->symbol (string-append "filter-category-" (symbol->string n)))) (define-syntax define-filter-category (syntax-rules () ((_ id string) (begin ;;; FIXME: also (define ,id string) (set! FILTER-CATEGORIES (cons string FILTER-CATEGORIES)))) ((_ name) (define-filter-category (id->category-id (quote name)) (id->category-string (quote name)))))) (define-filter-category distortion-effect) (define-filter-category ...) -- Christopher W. Bowron <ch...@bowron.us> [ Nothing is exciting if you know what the outcome will be ] - Joseph Campbell _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users