Sujet : Re: May the numbers speak - supplement
De : dxforth (at) *nospam* gmail.com (dxf)
Groupes : comp.lang.forthDate : 12. Jun 2025, 05:34:57
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <7c15e1538a1604ad3c7a293ae6196da2530cd1a4@i2pn2.org>
References : 1 2 3 4 5 6
User-Agent : Mozilla Thunderbird
On 12/06/2025 2:55 am, Hans Bezemer wrote:
On 11-06-2025 18:29, minforth wrote:
From the other optimizers team :o)
Extra simple and easy to maintain
(for well-formed hh:mm:ss):
>
# : hms ':' parse evaluate ':' parse evaluate bl parse evaluate ; ok
# hms 12:59:21 ok
12 59 21 #
>
--
Can't replicate it in 4tH, but I'll take it! :)
I replicated it.
App before optimization: 9 Kb
App after optimization: 28 Kb
It took a while to work out how to pass the string to the interpreter
but eventually got there ...
: >HMS ( a u -- sec min hr )
blk @ >in @ 2>r source 2>r 'source 2! 0 >in !
[char] : parse evaluate [char] : parse evaluate
bl parse evaluate
2r> 'source 2! 2r> >in ! blk !
swap rot ;
'Use the Forth Interpreter, Luke.' Yeah, right :)