Subject: Re: Iteration in lisp
From: (Rob Warnock)
Date: Sat, 03 May 2008 22:11:06 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
John Thingstad <> replied [to Kent]:
| > I actually don't know which implementations do this.  I just know people
| > complain that some do and seem not to like writing SETQ at toplevel.
| Usually I would want defparameter at the toplevel REPL.
| I use the history to retrieve it to re-test.
| defvar is only for things you want to survive through the session.
| As such it is almost as dangerous as declaring something defconstant.

Agreed, which is why when I defined my version of DEFLEX[1]
to use DEFPARAMETER semantics (similar in that way to Scheme's
top-level DEFINE) instead of DEFVAR semantics. [From time to
time I've thought of adding a DEFLEX/ONCE with DEFVAR semantics,
but sufficient motivation has never arisen. ;-} ]

Typing (DEFLEX FOO 13) is almost as short as typing (SETQ FOO 13),
but is a *lot* less dangerous if later code should rebind FOO!  ;-}
And it's also more portable[2]...



[2] The semantics, that is, assuming you load
    the DEFLEX macro in your CL's init file.

Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607