Re: Iteration in lisp




(1) The extreme camp that says "oops, you misspelled something. I've
helpfully autodeclared it pervasively special." I think this is
really definitely not good.


right! A real pain.

(2) The moderate but still unwanted-by-me situation of taking

TOPLEVEL-LISP-PROMPT> (setq x 3)

or a programmatic call to (eval '(setq x 3))

as an opportunity to lecture the person about how x is undeclared and
maybe you don't really mean for it to be special. As I said, I can tolerate
it being silently taken as lexical in an implementation that wants to offer
such support, even by default. But what I don't want to be told is "I'm not
going to do something cool and innovative, nor am I even going to do the
obvious only thing that's left to do in the absence of something cool and
innovative--I'm just going to tell you that Lisp is hard to use and that you
should have an unpleasant interactive experience."

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.

(on my list list of regrettable decisions)

--------------
John Thingstad
.



Relevant Pages

  • Re: Questions about passing cons as parameter and the behavior of pop
    ... modifies the place. ... Lisp program, there is a hypothetical meta-program that can be thought ... The meta-level at which a side-effect occurs when a SETQ is done is ... do this even if the varname is implemented by a symbol macro and ...
    (comp.lang.lisp)
  • Re: newbie question concatenate function useage
    ... (Though as language standards go, ... > is to teach Lisp. ... usual to declare local variables's scope if it is declared within the ... "setq" function with "defun". ...
    (comp.lang.lisp)
  • Re: idiomatic Lisp style
    ... (setq total 0) ... not sure you want to say "unlike" when Lisp does the same as what you are unliking: ... standard does not require the situation to be diagnosed as an unbound error. ... a data structure, in effect, with a name unique within a package. ...
    (comp.lang.lisp)
  • Nikodemus Common Lisp FAQ
    ... I finally got fed up with the state of all the FAQ efforts, ... Nikodemus' Common Lisp FAQ ... This is a highly uncanonical Common Lisp FAQ with a strong editorial ... which was eventually abbreviavated to SETQ: ...
    (comp.lang.lisp)
  • Re: Nikodemus Common Lisp FAQ
    ... Nikodemus' Common Lisp FAQ ... This is a highly uncanonical Common Lisp FAQ with a strong editorial ... Short answer: Always use SETF. ... which was eventually abbreviavated to SETQ: ...
    (comp.lang.lisp)