Deutsch English Français Italiano |
<8263ce17c2bc24361306cf0b88bc923b3019e84d@i2pn2.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: dxf <dxforth@gmail.com> Newsgroups: comp.lang.forth Subject: Re: Reverse SCAN SPLIT Date: Tue, 8 Oct 2024 13:58:47 +1100 Organization: i2pn2 (i2pn.org) Message-ID: <8263ce17c2bc24361306cf0b88bc923b3019e84d@i2pn2.org> References: <5c65a8f1fdfc3e9937a825842fe23dc2758f48ef@i2pn2.org> <068a1ece8e501de719f3a98b7f468f85@www.novabbs.com> <de0c54506503c1884844dd59a6492306@www.novabbs.com> <586c9cbef8f2205264590221dd832e1c2cecdf35@i2pn2.org> <c3785784f01b2fe23fc3613d9144c93e@www.novabbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 8 Oct 2024 02:58:50 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="1050420"; mail-complaints-to="usenet@i2pn2.org"; posting-account="XPw7UV90Iy7EOhY4YuUXhpdoEf5Vz7K+BsxA/Cx8bVc"; User-Agent: Mozilla Thunderbird In-Reply-To: <c3785784f01b2fe23fc3613d9144c93e@www.novabbs.com> Content-Language: en-GB X-Spam-Checker-Version: SpamAssassin 4.0.0 Bytes: 3654 Lines: 80 On 8/10/2024 6:25 am, Ahmed wrote: > On Mon, 7 Oct 2024 12:07:16 +0000, dxf wrote: > > .. > >> Interesting. I'd do the numeric conversion in the main routine if >> possible. >> There's a parsing issue with s" :30" > > And what about this: > > > : :t ( add cnt -- add 2 1 | add1 2 add2 2 2 | add1 2 add2 2 add3 2 3) > bounds ( end start) > dup ( end start start) > >r ( end start ) ( r: start) > swap ( start end ) ( r: start) > dup ( start end pa) > -rot ( pa start end ) > do ( pa) > i ( pa add) > c@ ( pa c) > [char] : = ( pa f) > if ( pa) > i ( pa add) > - ( pa-add) > dup ( pa-add pa-add) > 2 ( pa-add pa-add 2) > > ( pa-add t|f) > if ( pa-add) > drop ( ) > i ( add) > dup ( add add) > 1+ ( add add+1) > 2 ( add add+1 2) > rot ( add+1 2 add) > else ( pa-add) > 1 = if ( ) > s" 00" ( add 2) > i ( add 2 add) > else ( ) > i ( add) > dup 1+ 1 ( add add+1 1) > rot ( add+1 1 add) > then > then > then > -1 +loop ( ... add+1 1|2 pa) > r> ( pa start) > tuck ( start pa start) > - ( start pa-st) > dup 0= if 2drop s" 00" then > ; > > > : .t ( s_add s_cnt m_add m_cnt h_add h_cnt) > type space ." hr" space > type space ." min" space > type space ." sec" > ; > > with stack juggling !!!!!!!!!! swap dup -rot --> over > Some tests: > > > s" 10:1:2" :t .t 10 hr 1 min 2 sec ok > s" :10:" :t .t 00 hr 10 min 00 sec ok > s" ::" :t .t 00 hr 00 min 00 sec ok > s" ::1" :t .t 00 hr 00 min 1 sec ok > s" :10:1" :t .t 00 hr 10 min 1 sec ok > s" :10:" :t .t 00 hr 10 min 00 sec ok > s" 10:10:" :t .t 10 hr 10 min 00 sec ok > s" 10::" :t .t 10 hr 00 min 00 sec ok I wouldn't care about "x:" or "x::x" Maybe also ":x" But "5" needs to work :)