help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: elisp: how to pass a list argument to defun


From: Le Wang
Subject: Re: elisp: how to pass a list argument to defun
Date: 28 Jun 2006 13:59:37 -0700
User-agent: G2/0.2

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("?!?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



reply via email to

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