After months of postponing, I'm finally reading about the
condition system. The notes about the function ERROR in CLHS
discuss this function:
(defun wargames:no-win-scenario ()
(if (error "pushing the button would be stupid."))
(push-the-button))
Should (push-the-button) be inside the IF form, or is the IF
entirely superfluous? As written, the IF form has no then-form,
and I'd expect the function to fail before it even calls ERROR.
Should I have mailed this somewhere, instead of asking here?
Kalle Olavi Niemitalo <···@iki.fi> writes:
>
> After months of postponing, I'm finally reading about the
> condition system. The notes about the function ERROR in CLHS
> discuss this function:
>
> (defun wargames:no-win-scenario ()
> (if (error "pushing the button would be stupid."))
^
t
If memory serves, there's supposed to be a "t" conditional in the if.
Or you can remove the (if ...) bracketing and just call error at
definition toplevel before thep ush-the-button call.
> (push-the-button))
>
> Should (push-the-button) be inside the IF form, or is the IF
> entirely superfluous? As written, the IF form has no then-form,
> and I'd expect the function to fail before it even calls ERROR.
>
> Should I have mailed this somewhere, instead of asking here?
Well, mail to me or steele wouuld have worked, but this is fine.
In article <··············@Astalo.y2000.kon.iki.fi>, "Kalle Olavi
Niemitalo" <···@iki.fi> wrote:
> After months of postponing, I'm finally reading about the condition
> system. The notes about the function ERROR in CLHS discuss this
> function:
>
> (defun wargames:no-win-scenario ()
> (if (error "pushing the button would be stupid."))
> (push-the-button))
>
> Should (push-the-button) be inside the IF form, or is the IF entirely
> superfluous? As written, the IF form has no then-form, and I'd expect
> the function to fail before it even calls ERROR.
>
> Should I have mailed this somewhere, instead of asking here?
This probably was intended to read
(if (error "blablabla")
(push-the-button))
Ie. you will never push the button because when evaluating the condition
you will cause an error..
"Daniel Lakeland" <········@silnospamcon.com> writes:
> In article <··············@Astalo.y2000.kon.iki.fi>, "Kalle Olavi
> Niemitalo" <···@iki.fi> wrote:
>
> > After months of postponing, I'm finally reading about the condition
> > system. The notes about the function ERROR in CLHS discuss this
> > function:
> >
> > (defun wargames:no-win-scenario ()
> > (if (error "pushing the button would be stupid."))
> > (push-the-button))
> >
> > Should (push-the-button) be inside the IF form, or is the IF entirely
> > superfluous? As written, the IF form has no then-form, and I'd expect
> > the function to fail before it even calls ERROR.
> >
> > Should I have mailed this somewhere, instead of asking here?
>
> This probably was intended to read
>
> (if (error "blablabla")
> (push-the-button))
>
> Ie. you will never push the button because when evaluating the condition
> you will cause an error..
I thought I answered this already.
In the original paper, there is a predicate (true) which if it's not present
is a typo. See http://world.std.com/~pitman/Papers/Revision-18.txt
which is the original source document for that chapter of Steele's text.
(DEFUN WARGAMES:NO-WIN-SCENARIO ()
(IF (TRUE) (ERROR "Pushing the button would be stupid."))
(PUSH-THE-BUTTON))
Making the call to error be the predicate would confuse it even more than
it's aready confused. I probably should have just done
(DEFUN WARGAMES:NO-WIN-SCENARIO ()
(ERROR "Pushing the button would be stupid.")
(PUSH-THE-BUTTON))
to illustrate the control flow in question, but I figured this would look
stupid since normally some computation would occur in deciding. But I wanted
the computation to end up always calling ERROR. At the meta-level, the
entire example was a no-win scenario. But if it's screwed up in Steele (I
don't have my copy handy as I write this) , that's just a typo.
Steele may have started to edit this because TRUE was not a defined function
in CL (not that the WARGAMES package is a defined package either).