[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CL compatibility question
From: |
Lawrence Mitchell |
Subject: |
Re: CL compatibility question |
Date: |
Thu, 06 May 2004 22:53:39 +0100 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 |
Joe Corneli wrote:
[...]
> In ELISP, not so great.
> (defbashfun taco (beef beans)
> (car $@))
> (taco t nil)
> ;=> Debugger entered--Lisp error: (wrong-number-of-arguments
> (lambda (name lambda &body body) (\` (defun (\, name) (&rest
> $@) (apply (lambda (\, lambda) (\,@ body)) $@)))) 3)
This is because &body isn't a recognised lambda list keyword in
emacs lisp. If you want to use full CL-style lambda lists in
DEFUN and DEFMACRO forms, you should do:
(require 'cl)
and use the DEFUN* and DEFMACRO* forms (note star).
(defmacro* defbashfun (name lambda &body body)
`(defun ,name (&rest $@)
(apply (lambda ,lambda ,@body) $@)))
(defbashfun taco (beef beans) (car $@))
(taco t nil) => t
Alternately, define defbashfun as:
(defmacro defbashfun (name lambda &rest body)
...)
[...]
--
Lawrence Mitchell <wence@gmx.li>