nyef wrote:
I shall also take the position that -1 SET-ORDER (to set a minimal search order) should leave an entry on the stack, preferably -1. Justification: ( widn ... wid1 n -- ) absorbs n wordlists, and n. If n is zero, it absorbs zero wordlists and n. If n is -1, it clearly _produces_ a stack entry after removing n, and that stack entry might as well be n. Counterarguments appreciated.
I like your thought that -1 should "remove" -1 items from the stack, thereby leaving one. It took me a couple of minutes to figure out what you were talking about.
The example implementation they give is:
Code:
: SET-ORDER ( wid1 ... widn n -0 )
DUP -1 = IF
DROP <push system default word lists and n>
THEN
DUP #order !
0 ?DO I CELLS context + ! LOOP
;
It looks like they are just using the -1 as a flag, replacing it with whatever wordlists (more than 1 seems to be allowed) and an appropriate n before the code continues processing the normal way. #order is a variable holding the number of wordlists in the search order, and context is an array that holds the wids (Wordlist IDentifiers).
If you do set 0 wordlists in the search order, then every word you type after that point is undefined, right? There's no way to fix that except to reset the system. That's the part that I'm having trouble with, but it seems like the standard calls for that behavior (if the user asks for it, of course).