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

----- Original Message -----
From: "P-O Yliniemi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 23, 2001 3:10 PM
Subject: [REBOL] word list


>
> 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
> [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
> [b]
> >> 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
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to