From: Stuart Duncan
Subject: Simple defun list passing question
Date: 
Message-ID: <81l08o$1qd$1@testinfo.cs.uoguelph.ca>
I was wondering if anyone could tell me what the proper way to pass a list
in lisp to a function defined using defun.
I am basically trying to setup something like this :

(defun foo  (x)  
	(first (x)))


Basically I want to pass a list to the function and have it return the
first element of the list, and do any other functions that can be done on
lists. Basically after i load the lsp file i want to be able to type

(foo'(one two three))

and have foo perform operation on this list.
Any help on this  would be much appreciated.
Please reply to the email addresss becuase my new
server timeouts articles somewhat quickly.

SD 
From: Barry Margolin
Subject: Re: Simple defun list passing question
Date: 
Message-ID: <tjo%3.18$Sv6.267@burlma1-snr2>
In article <············@testinfo.cs.uoguelph.ca>,
Stuart Duncan  <·······@eddie.cis.uoguelph.ca> wrote:
>I was wondering if anyone could tell me what the proper way to pass a list
>in lisp to a function defined using defun.

The same way you pass anything else.

>I am basically trying to setup something like this :
>
>(defun foo  (x)  
>	(first (x)))
>
>
>Basically I want to pass a list to the function and have it return the
>first element of the list, and do any other functions that can be done on
>lists. Basically after i load the lsp file i want to be able to type

Just refer to X as a variable:

(defun foo (x)
  (first x))

This is something really basic.  I'm curious how you could be doing
*anything* in Lisp if you didn't know this.

When you write (x) in your function, you're trying to call a function named
X rather than use the value of the variable.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.