[Top][All Lists]

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

CL compatibility question

From: Joe Corneli
Subject: CL compatibility question
Date: Thu, 06 May 2004 14:36:09 -0500

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 $@)))
* call-interactively(eval-last-sexp)

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

reply via email to

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