This is the mail archive of the
guile-emacs@sourceware.cygnus.com
mailing list for the Guile project.
Re: special forms (save-excursion)
Keisuke Nishida <kxn30@po.cwru.edu> writes:
> Kalle Olavi Niemitalo <tosi@ees2.oulu.fi> writes:
>
> > Should I use defmacro instead of syntax-rules? I like
> > syntax-rules more, but it seems slower.
>
> I think faster one is better. This is not a complex syntax and
> easy to maintain.
But the macros made with define-macro (what is the difference
between that and defmacro?) are not hygienic by default. Should
we hygienize each of them separately, or do we just give people a
list of symbols which they must not rebind when using the macros?
> (define-public (lisp-false? sexp) (or (eq? sexp ()) (eq? sexp nil)))
R5RS doesn't say what () evaluates to, so it would be better to
quote it.
I believe "sexp" means the usual printed form of an expression.
The parameter of lisp-false? is the object itself, not a printed
form. Use "obj" instead.
> (define-public (lisp-variable-set! symbol value)
> (lisp-eval `(setq ,symbol ,value)))
The value should be quoted in the setq call.
(define-public (lisp-variable-set! symbol value)
(lisp-eval `(setq ,symbol ',value)))
> (define-macro (import-lisp-variable-1 variable . rest)
> (let ((name (if (pair? rest) (car rest) variable)))
> `(define ,name (make-procedure-with-setter
> (lambda () (lisp-variable-ref ',variable))
> (lambda (value) (lisp-variable-set! ',variable value))))))
> (define-public import-lisp-variable import-lisp-variable-1)
Can't you just (export import-lisp-variable-1)?