Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #132419

Re: Reverse SCAN SPLIT

From dxf <dxforth@gmail.com>
Newsgroups comp.lang.forth
Subject Re: Reverse SCAN SPLIT
Date 2024-10-07 23:13 +1100
Organization i2pn2 (i2pn.org)
Message-ID <d20baa2948b40b2043af3adc40a05054c82ad22e@i2pn2.org> (permalink)
References <5c65a8f1fdfc3e9937a825842fe23dc2758f48ef@i2pn2.org>

Show all headers | View raw


On 7/10/2024 7:52 pm, dxf wrote:
> Earlier I mentioned scanning in reverse.  Here's an implementation.
> 
> [undefined] dxforth [if]
> : \CHAR ( a u -- a2 u2 c )  1- 2dup + c@ ;
> [then]
> 
> \ As for SCAN but scan from end
> : SCAN< ( a u c -- a2 u2 | a 0 )
>   >r over swap begin dup while \char r@ = until 1+ then
>   rot drop rdrop ;
> 
> \ As for SPLIT but scan from end. Latter string is topmost.
> : SPLIT< ( a u c -- a2 u2 a3 u3 )
>   >r 2dup r> scan< 2swap 2 pick /string ;

Checking I see F-PC has -SCAN which appears to work similarly to SCAN< .
I'll be renaming my def's to -SCAN and -SPLIT respectively.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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