home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,883 of 117,927   
   Hans Bezemer to dxf   
   Re: Reverse SCAN SPLIT   
   16 Oct 24 18:13:33   
   
   From: the.beez.speaks@gmail.com   
      
   On 10-10-2024 11:57, dxf wrote:   
   > I wasn't aware you had reverse split.   
   > I was coming to the conclusion SCAN< as I defined it was of little   
   > value on it's own and planned to subsume it into reverse split.   
   > OTOH a reverse SCAN that gave the same results as forward SCAN might   
   > be useful.   
      
   I got a full load of the whole shebang - since I have to parse some   
   crazy stuff sometimes. It may not be pretty, but it served me well   
   through the years (since 2004).   
      
   Basically I can scan whatever I like however I like it:   
      
   ---8<---   
   : (NO) NOT ;   
   : (YES) ;   
      
   defer is-type                          ( c -- f)   
      
   : (-tokenize)                          ( a1 n2 xt -- a2 n2 )   
      is ?not begin dup while 2dup 1- chars + c@ is-type ?not while 1- repeat   
      
                                           ( a1 n2 xt -- a2 n2)   
   : (tokenize) is ?not begin dup while over c@ is-type ?not while chop   
   repeat ;   
   : scan> ['] (no)  (tokenize) ;         ( a1 n1 -- a2 n2 )   
   : scan< ['] (no)  (-tokenize) ;        ( a1 n1 -- a2 n2 )   
   : skip> ['] (yes) (tokenize) ;         ( a1 n1 -- a2 n2 )   
   : skip< ['] (yes) (-tokenize) ;        ( a1 n1 -- a2 n2 )   
   : split> 2dup scan> 2swap >r over r> swap - ;   
   : split< dup >r scan< 2dup chars + -rot r> over - -rot ;   
                                           ( a1 n1 -- a2 n2 a3 n3)   
   ---8<---   
      
   It's still 4tH stuff so your mileage may vary.   
      
   Hans Bezemer   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca