Sujet : Re: May the numbers speak - supplement
De : no.email (at) *nospam* nospam.invalid (Paul Rubin)
Groupes : comp.lang.forthDate : 12. Jun 2025, 21:42:27
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87o6us3d58.fsf@nightsong.com>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
mhx@iae.nl (mhx) writes:
It doesn't do the same thing. It isn't faster, which points out
the '60 *' and 'M* D+' are not the limiting factors.
Oh I copied the interface from another post, didn't realize it was
supposed to convert to seconds. I didn't care about the speed since any
slowness in any of these versions can be blamed on the compiler ;).
Here is another version:
variable p
: advance 1 p +! ;
: digit ( -- n ) p @ c@ '0' - advance ;
: 2digit ( -- n ) digit 10 * digit + advance ; \ skips trailing colon
: hms ( a u -- n ) drop p ! 2digit 60 * 2digit + 60 * 2digit + ;
: test clearstack s" 12:34:56" hms ;
test .s