Sujet : Re: Number parsing with checks
De : ruvim.pinka (at) *nospam* gmail.com (Ruvim)
Groupes : comp.lang.forthDate : 12. Oct 2024, 18:52:28
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <veed0t$8qau$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 2024-10-12 20:40, mhx wrote:
On Sat, 12 Oct 2024 14:46:52 +0000, Ruvim wrote:
On 2024-10-12 17:54, Ruvim wrote:
On 2024-10-12 05:45, dxf wrote:
The basics:
[..]
: ZE? ( x -- ) if .bad then ; \ abort if non-zero
: NZ? ( x -- ) 0= ze? ; \ abort if zero
>
Typically, if word name ends with a question mark, the first (top)
output parameter of the word is a *flag*. And it's true for all
standard words. (though, opposite is not true)
>
These are better names and narrower stack diagrams:
>
DROP-NZ ( x\0 -- | 0 -- never )
DROP-ZE ( 0 -- | x\0 -- never )
>
I do not like these names too.
>
These seem better:
>
?NZ-DROP
?ZE-DROP
[..]
My convention has always been that if a word starts with
a '?', it tests and [possibly] aborts. This makes
'-DROP' unnecessary.
Agreed.
Two words can be used if you need to drop, as:
?NZ DROP
?ZE DROP
-- Ruvim