How to expand macros in guile scheme? -


i'm trying write let on lambda defmacro/g! in guile scheme. have this:

(use-modules (srfi srfi-1))  (define (flatten x)     (let rec ((x x) (acc '()))          (cond ((null? x) acc)                ((not (pair? x)) (cons x acc))                (else                 (rec (car x)                      (rec (cdr x) acc))))))  (define (g!-symbol? s)   (and (symbol? s)        (let ((symbol-string (symbol->string s)))          (and (> (string-length symbol-string) 2)               (equal? (string-downcase (substring symbol-string 0 2)) "g!")))))   (define-macro (define-macro/g! name-args . body)     (let ((syms (delete-duplicates                  (filter g!-symbol? (flatten body)))))     `(define-macro ,name-args          (let ,(map                 (lambda (s)                   `(,s (gensym ,(substring (symbol->string s) 2))))                 syms)            ,@body)))) 

but when try macro expand define-macro/g! using this:

(use-modules (language tree-il)) (tree-il->scheme (macroexpand '(define-macro/g! (foo . body) `(let ((g!car ,(car body))) g!car)))) 

i've got this:

$15 = (if #f #f) 

why i've got result? how can expand define-macro/g!?

i need use code:

(define macro '(define-macro/g! (foo . body) `(let ((g!car ,(car body))) g!car))) (tree-il->scheme (macroexpand macro 'c '(compile load eval))) 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -