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,575 of 117,927   
   Gerry Jackson to Ruvim   
   Re: 0 SET-ORDER why?   
   27 Jun 24 05:14:06   
   
   From: do-not-use@swldwa.uk   
      
   On 26/06/2024 14:36, Ruvim wrote:   
   > One possible use case:   
   >   
   >    : turnkey ( -- ) 0 set-order   
   >      also Target definitions   
   >      also Minimal also   
   >    ;   
      
   ALSO duplicates the wordlist at the head of the search order. If the   
   search order is empty there is nothing to duplicate. Therefore ALSO   
   applied to an empty search order ought to be an ambiguous condition.   
      
   Presumably the above definition works because a target wordlist replaces   
   whatever garbage ALSO leaves in the search order. So the definition   
   might as well have 0 1 SET-ORDER instead of 0 SET-ORDER ALSO.   
   Or better still TARGET-WORDLIST 1 SET-ORDER. Either removes the above   
   justification for 0 SET-ORDER.   
      
   But having said that it is better for 0 SET-ORDER to do what is natural   
   instead of yet another ambiguous condition.   
      
    > Another possible use case:   
    >   
    >    : s-to-n ( addr u -- n )   
    >      depth >r   
    >      get-order n>r 0 set-order   
    >        ['] evaluate ['] execute-interpreting catch   
    >      nr> set-order   
    >      depth 1- r> <> if -12 throw then   
    >    ;   
      
   This is a better use case e.g. if BASE is greater than decimal 10   
   converting an alphanumeric string to a number could clash with a word in   
   the dictionary. Having an empty search order eliminates that possibility.   
      
   Incidentally another possibility is that if ['] EVALUATE is replaced in   
   the above definition with ['] SOME-RECOGNISER, that could be the basis   
   for an ANS/FORTH 2012 compatible way of implementing recognisers. If the   
   recogniser fails restore the search order and try again.   
      
   --   
   Gerry   
      
   --- 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