unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* CL compatibility question
@ 2004-05-06 19:36 Joe Corneli
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Corneli @ 2004-05-06 19:36 UTC (permalink / raw)



Frode Vatvedt Fjeld suggested (on comp.lang.lisp, 2004-05-06) the
following approach to building something like Bash's `$@' in LISP:

(defmacro defbashfun (name lambda &body body)
  `(defun ,name (&rest $@)
     (apply (lambda ,lambda ,@body) $@)))

In CLISP, this works great.  

(defbashfun taco (beef beans)
  (car $@))
(taco t nil)
;=> T

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)
  (lambda (name lambda &body body) (\` (defun ... ... ...)))(taco (beef beans) (car $@))
  (defbashfun taco (beef beans) (car $@))
  eval((defbashfun taco (beef beans) (car $@)))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
* call-interactively(eval-last-sexp)

Why is this?  Are there plans that would change this behavior in the
future?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-05-06 22:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.3786.1083877034.1061.help-gnu-emacs@gnu.org>
2004-05-06 21:53 ` CL compatibility question Lawrence Mitchell
2004-05-06 21:56 ` Stefan Monnier
2004-05-06 22:02 ` Miles Bader
2004-05-06 19:36 Joe Corneli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).