guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

macro syntax


From: Aurelien Chanudet
Subject: macro syntax
Date: Sun, 30 Oct 2005 01:38:46 +0200

Hi all,

Please consider the following lines of code :

(defmacro-public new-func (f x) `(define (,f) ,x))

(define alist (list (cons "f" 1) (cons "g" 2)))

(define (find-x f) (cdr (assoc f alist)))

(new-func f (find-x "f"))
(new-func g (find-x "g"))

How can I rewrite the macro new-func to factor out find-x in the macro
definition ?

Thanks,
Aurelien




reply via email to

[Prev in Thread] Current Thread [Next in Thread]