Re: test for empty stack
- From: "John H Meyers" <jhmeyers@xxxxxxxxxxxxxx>
- Date: Wed, 06 Sep 2006 21:25:10 -0500
On Wed, 06 Sep 2006 17:52:54 -0500, Virgil wrote:
This is not a test for an empty stack but a test for lack of input.
If one does "" "" INPUT ENTER one gets "" on the stack.
Aha, the "delay line" in my head was still seeing "DEPTH,"
but you did say DUP SIZE (not DEPTH), sorry!
Well, now that my brain is starting to catch up with what you
actually said, isn't a space (or other non-compiling stuff)
returned by INPUT also very similar to "no input"?
If the purpose of INPUT is eventual parsing,
I think that the only way to find out what the string
actually represents is to parse it, then see what one got.
The OP had asked "I am writing a program
which requires one input value.
I wanted to trap the error of no input
in which case I would assign a value."
A later suggestion to use INPUT to ask for a value
brought out my "standard stump speech" about INPUT:
In general, to get "a [unspecified type] value,"
one must parse the string after INPUT,
after which in general you are no better off
than if you just started your program having no idea what,
if anything, was put on the stack,
unless unusual care is taken in parsing.
Oh well, stump speech over -- what was the question? ;-)
Given the Subject: test for empty stack
and:
"I am writing a program which requires one input value.
I wanted to trap the error of no input
in which case I would assign a value."
Gee, I've done that exact thing, many times...
how did it go, then? Oh yes, it was:
DEPTH NOT default.value IFT
Sorry for my not paying attention :)
Lesson plan:
http://www.uoregon.edu/~ftepfer/SchlFacilities/TireSwingTable.html
http://home.insightbb.com/~gregorym/it.jpeg
[r->] [OFF]
.
- Follow-Ups:
- Re: test for empty stack
- From: Virgil
- Re: test for empty stack
- References:
- test for empty stack
- From: blenno
- Re: test for empty stack
- From: Heiko Arnemann
- Re: test for empty stack
- From: John H Meyers
- Re: test for empty stack
- From: Virgil
- Re: test for empty stack
- From: John H Meyers
- Re: test for empty stack
- From: Virgil
- test for empty stack
- Prev by Date: Re: Periodic Table
- Next by Date: How do I type in d^2/x^2(f(x))
- Previous by thread: Re: test for empty stack
- Next by thread: Re: test for empty stack
- Index(es):
Relevant Pages
|