Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!newstand.syr.edu!news.maxwell.syr.edu!news.mathworks.com!howland.erols.net!ix.netcom.com!vrotney
From: vrotney@netcom.com (William Paul Vrotney)
Subject: Re: Modifiable parameters?
In-Reply-To: cosc19z5@Bayou.UH.EDU's message of 10 Feb 1997 23:27:22 GMT
Message-ID: <vrotneyE5F59K.H4y@netcom.com>
Organization: Netcom On-Line Services
References: <5doasq$ul1@Masala.CC.UH.EDU>
Date: Tue, 11 Feb 1997 03:20:07 GMT
Lines: 28
Sender: vrotney@netcom.netcom.com


In article <5doasq$ul1@Masala.CC.UH.EDU> cosc19z5@Bayou.UH.EDU
(cosc19z5@bayou.uh.edu) writes:

> 
> (defun fn (x)
>   (set x some-value))
> 
> (setq p 100)
> (fn 'p)  ;; This changes the value of p
> 
> Now, I'm just wondering is this the proper way of doing things?
> Is there a better way of doing it?  The thought of manipulating
> symbols like that has some warning bells ringing in the back
> of my head, but I could use some advice from those more experienced
> than I.
> 

No problem, this is proper.  'set' is very useful for writing programs that
interpret Lisp code which may be what you are doing.  For example, you
mentioned Emacs, the function M-x set-variable would need to use 'set' to
set a variable name that you give it.  Your head ringing was due to the fact
that rarely do Lisp programmers have to use either 'set' or 'eval' but
sometimes it is either necessary or more straightforward.

-- 

William P. Vrotney - vrotney@netcom.com
