unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joe Corneli <jcorneli@math.utexas.edu>
Subject: CL compatibility question
Date: Thu, 06 May 2004 14:36:09 -0500	[thread overview]
Message-ID: <E1BLofB-0007kA-00@linux183.ma.utexas.edu> (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?

             reply	other threads:[~2004-05-06 19:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-06 19:36 Joe Corneli [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1BLofB-0007kA-00@linux183.ma.utexas.edu \
    --to=jcorneli@math.utexas.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).