Deutsch   English   Français   Italiano  
<7c15e1538a1604ad3c7a293ae6196da2530cd1a4@i2pn2.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From: dxf <dxforth@gmail.com>
Newsgroups: comp.lang.forth
Subject: Re: May the numbers speak - supplement
Date: Thu, 12 Jun 2025 14:34:57 +1000
Organization: i2pn2 (i2pn.org)
Message-ID: <7c15e1538a1604ad3c7a293ae6196da2530cd1a4@i2pn2.org>
References: <20129e22c76a2b18b0a745e9499cbd9b@www.novabbs.com>
 <nnd$673c55b0$2ad8f129@7aad895b352201b7>
 <cc0a8c7a3216f3ed508bde73fc8bd422@www.novabbs.com>
 <feed5481a2c6f29340546fbefb23bb31@www.novabbs.com>
 <37a6f52a3ab1ec533fcf7ef30beb1022@www.novabbs.com>
 <nnd$673c55b0$2ad8f129@52950e570341256b>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 12 Jun 2025 04:34:58 -0000 (UTC)
Injection-Info: i2pn2.org;
	logging-data="142676"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="XPw7UV90Iy7EOhY4YuUXhpdoEf5Vz7K+BsxA/Cx8bVc";
User-Agent: Mozilla Thunderbird
X-Spam-Checker-Version: SpamAssassin 4.0.0
Content-Language: en-GB
In-Reply-To: <nnd$673c55b0$2ad8f129@52950e570341256b>

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 :)