Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #132423
| From | dxf <dxforth@gmail.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Reverse SCAN SPLIT |
| Date | 2024-10-08 13:58 +1100 |
| Organization | i2pn2 (i2pn.org) |
| Message-ID | <8263ce17c2bc24361306cf0b88bc923b3019e84d@i2pn2.org> (permalink) |
| References | <5c65a8f1fdfc3e9937a825842fe23dc2758f48ef@i2pn2.org> <068a1ece8e501de719f3a98b7f468f85@www.novabbs.com> <de0c54506503c1884844dd59a6492306@www.novabbs.com> <586c9cbef8f2205264590221dd832e1c2cecdf35@i2pn2.org> <c3785784f01b2fe23fc3613d9144c93e@www.novabbs.com> |
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 :)
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
Reverse SCAN SPLIT dxf <dxforth@gmail.com> - 2024-10-07 19:52 +1100
Re: Reverse SCAN SPLIT melahi_ahmed@yahoo.fr (Ahmed) - 2024-10-07 09:55 +0000
Re: Reverse SCAN SPLIT melahi_ahmed@yahoo.fr (Ahmed) - 2024-10-07 10:03 +0000
Re: Reverse SCAN SPLIT dxf <dxforth@gmail.com> - 2024-10-07 23:07 +1100
Re: Reverse SCAN SPLIT melahi_ahmed@yahoo.fr (Ahmed) - 2024-10-07 19:25 +0000
Re: Reverse SCAN SPLIT dxf <dxforth@gmail.com> - 2024-10-08 13:58 +1100
Re: Reverse SCAN SPLIT melahi_ahmed@yahoo.fr (Ahmed) - 2024-10-08 06:02 +0000
Re: Reverse SCAN SPLIT Ruvim <ruvim.pinka@gmail.com> - 2024-10-07 14:02 +0400
Re: Reverse SCAN SPLIT dxf <dxforth@gmail.com> - 2024-10-07 22:22 +1100
Re: Reverse SCAN SPLIT dxf <dxforth@gmail.com> - 2024-10-07 23:13 +1100
Re: Reverse SCAN SPLIT dxf <dxforth@gmail.com> - 2024-10-10 17:00 +1100
Re: Reverse SCAN SPLIT albert@spenarnc.xs4all.nl - 2024-10-10 10:00 +0200
Re: Reverse SCAN SPLIT dxf <dxforth@gmail.com> - 2024-10-10 20:57 +1100
Re: Reverse SCAN SPLIT Hans Bezemer <the.beez.speaks@gmail.com> - 2024-10-16 18:13 +0200
Re: Reverse SCAN SPLIT albert@spenarnc.xs4all.nl - 2024-10-17 10:28 +0200
Re: Reverse SCAN SPLIT minforth@gmx.net (minforth) - 2024-10-17 09:16 +0000
Re: Reverse SCAN SPLIT mhx@iae.nl (mhx) - 2024-10-17 10:29 +0000
Re: Reverse SCAN SPLIT albert@spenarnc.xs4all.nl - 2024-10-17 12:48 +0200
Re: Reverse SCAN SPLIT dxf <dxforth@gmail.com> - 2024-10-19 01:41 +1100
Re: Reverse SCAN SPLIT albert@spenarnc.xs4all.nl - 2024-10-19 13:36 +0200
Re: Reverse SCAN SPLIT dxf <dxforth@gmail.com> - 2024-10-18 12:10 +1100
csiph-web