Subject:
|
RE: What does =0 do ?
|
Newsgroups:
|
lugnet.robotics.rcx.pbforth
|
Date:
|
Tue, 23 Jul 2002 13:52:16 GMT
|
Reply-To:
|
<rhempel@bmts.com{spamless}>
|
Viewed:
|
2996 times
|
| |
| |
Richard,
A little known fact is that if you "punctuate" a number with any of
the following characters ,./-: you will get a double on the stack in
the old FIG Forth.
so 123-4567 will put the double value 1234567 on the stack.
So why doesn't 0= get interpreted this way? Good question.
The answer is that Forth looks for a sequence of characters in the
dictionary first, then tries to convert to a number, then gives up.
I need to see if the = is used as punctuation in pbForth....
From a quick reading of the code, it looks like ANY non-digit
for the current BASE is used as punctuation for a double.
So, you can either look at this as a minor annoyance and be
careful how you type, or you can exploit the feature....
Nice catch, Richard!
Cheers, Ralph
> -----Original Message-----
> From: news-gateway@lugnet.com [mailto:news-gateway@lugnet.com]On Behalf
> Of Richard Lucock
> Sent: Tuesday, July 23, 2002 5:08 AM
> To: lugnet.robotics.rcx.pbforth@lugnet.com
> Subject: What does =0 do ?
>
>
> Hi,
> While entering a program last night, I typed =0 instead of 0=, and the
> interpreter accepted it; it took me quite a while to work out why my program
> wasn't working properly. =0 does not seem to be a word (ie ' =0 results in the
> "not found" error) so why does it get accepted, and what is it doing ? (I end
> up with 60 on the stack after executing this word, although I didn't
> investigate what else it was doing).
>
> Cheers,
> Richard
>
|
|
Message is in Reply To:
| | What does =0 do ?
|
| Hi, While entering a program last night, I typed =0 instead of 0=, and the interpreter accepted it; it took me quite a while to work out why my program wasn't working properly. =0 does not seem to be a word (ie ' =0 results in the "not found" error) (...) (22 years ago, 23-Jul-02, to lugnet.robotics.rcx.pbforth)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|