all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Le Wang" <l26wang@gmail.com>
Subject: Re: elisp: how to pass a list argument to defun
Date: 28 Jun 2006 13:59:37 -0700	[thread overview]
Message-ID: <1151528377.142358.184110@p79g2000cwp.googlegroups.com> (raw)
In-Reply-To: mailman.3433.1151487404.9609.help-gnu-emacs@gnu.org

lalit mohan tripathi wrote:
> Hi All,
>
>    Could anyone tell me how to pass a list argument in elisp to a defun?
>
>    I'm want to write a defun like this
>
> (defun process-list-fn (list02, a, b, c)
>   "This function prints the list02, a, b, c."
>   (print list02)
>   (print a)
>   (print b)
>   (print c))
>
>
> I want to use it like this:
>
> (setq list01 '("abc" "def" "xyz"))
> (process-list-fn list01 10 20 30)
>
> But I get the following error:
>
> Debugger entered--Lisp error: (void-variable list02)
>   (print list02)
>   process-list-fn(("abc" "def" "xyz") 10 20 30)
>   eval((process-list-fn list01 10 20 30))
>   eval-last-sexp-1(nil)
>   eval-last-sexp(nil)
>   call-interactively(eval-last-sexp)
>   recursive-edit()
>   byte-code("?\b!?HG ?HH    !?H\n?C?
>
> P.S. I'm able to pass the list to a function but that works when the defun
> is defined with only one listarguement.

remove the commas from your defun formal parameters list.

--
Le

  parent reply	other threads:[~2006-06-28 20:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3433.1151487404.9609.help-gnu-emacs@gnu.org>
2006-06-28 10:03 ` elisp: how to pass a list argument to defun Tassilo Horn
2006-06-28 13:55 ` Pascal Bourguignon
2006-06-28 20:59 ` Le Wang [this message]
2006-06-28  9:36 lalit mohan tripathi

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

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

  git send-email \
    --in-reply-to=1151528377.142358.184110@p79g2000cwp.googlegroups.com \
    --to=l26wang@gmail.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.