Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

word list

 [1/4] from: peoyli::algonet::se at: 24-Apr-2001 0:10

Hi, I've tried to use a part of rebdoc.r to generate a list of all words before and after a function call.. The problem is that I also get a million of words that has no values in my lists, and this makes the function unusable for the purpose I was thinking of. The purpose was to generate a list before a function call, and compare it to a list generated afterwards, to see if a function by mistake has created new words. gen-word-list: func [ {Generate a list of all words} /local word-list words ][ word-list: make block! 1200 words: first system/words while [not tail? words] [ append word-list first words words: next words ] sort word-list ] Even if I unset something after use, I still get this word in the list generated after the word has been removed.
>> unset 'a >> word-list: gen-word-list >> a: "test" >> word-list2: gen-word-list >> probe difference word-list word-list2
>> find word-list2 'b
== none
>> b: "test" >> word-list: gen-word-list >> find word-list 'b
== [b back backlog...
>> probe difference word-list word-list2
>> unset 'b >> word-list: gen-word-list >> find word-list 'b
== [b back backlog... ... Is there any way to 'clean up' system/words from unused stuff ? /PeO

 [2/4] from: larry:ecotope at: 23-Apr-2001 15:51

Hi PeO This works:
>> words-with-vals: has [word-list][
word-list: copy [] foreach word first rebol/words [ if not error? try [get in rebol/words :word][append word-list word] ] word-list ]
>> wv: words-with-vals
== [unset! error! datatype! native! action! routine! op! function! object! struct! libr ary! port! any-type! any-word! any-function!...
>> length? wv
== 578 Cheers -Larry

 [3/4] from: peoyli:algonet:se at: 24-Apr-2001 11:53

Thanks Larry, after some time of more experimenting, I also got it working using the part from rebdoc.r (using if not unset? first vals ..), but your routine was more clean and compact. Maybe just a word-list: make block! 500 in the beginning may speed it up, even if it's not slow.. If I'm not too lazy to write something around this routine (which is probably easy enough to use stand-alone), I will creating something that prints a report on new words after a function call (or a code-snippet), maybe also check if some definition has changed. /PeO

 [4/4] from: ingo:2b1 at: 24-Apr-2001 22:48

Hi PeO, ... or you could use query ...
> query/clear system/words
== [end! unset! error! datatype! context! native! action! routine! op! function! object! struct! library! port! any-type! any-word!...
>> f: func [][a: 1] >> query system/words
== [f]
>> f
== 1
>> query system/words
== [f a]
kind regards, Ingo