{ --------------------------------------------------------------------
These words are more concise than the ALSO/PREVIOUS model of
search order management. I like them better, and have begun to
use them extensively.
-ORDER removes a WID from the context list returned by GET-ORDER and
+ORDER guarantees that the WID is in the context list a) only once,
and b) at the top, or first, in the search order.
Example: ( assuming a wordlist named ASM-WORDLIST )
ASM-WORDLIST +ORDER
... ( code referencing assembler things )
ASM-WORDLIST -ORDER
-------------------------------------------------------------------- }
: -ORDER ( wid -- )
>R GET-ORDER R> ( wid wid ... wid n wid)
0 >R BEGIN
SWAP ?DUP WHILE 1- SWAP ( wid...wid n wid)
ROT 2DUP = IF DROP ELSE
R> SWAP >R 1+ >R
THEN
REPEAT DROP
R> DUP BEGIN ( n n)
?DUP WHILE 1-
R> ROT ROT
REPEAT SET-ORDER ;
: +ORDER ( wid -- )
DUP -ORDER >R GET-ORDER R> SWAP 1+ SET-ORDER ;
.
Received on Thu Mar 18 1999 - 14:00:41 PST
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.