[REBOL] Re: Creating a list, writing it in a file
From: richard:coffre:francetelecom at: 12-Apr-2002 11:15
Thanks a lot
De : Carl Read [mailto:[carl--cybercraft--co--nz]]
Envoy=E9 : vendredi 12 avril 2002 10:17
=C0 : [rebol-list--rebol--com]
Objet : [REBOL] Re: Creating a list, writing it in a file
On 12-Apr-02, COFFRE Richard FTO wrote:
> Hi Carl and Joel
> I read your last answers but I wasn't precise enough in my query. My
> job is a little more complex.
> 1. Read the line and extract (if necessary) a function name. 2.
> Check if this function is already stored in my list, if not do it.
> 3. Once the file is read, sort the list 4. Write the list in a file.
> The step 2 explains why I can't just read the file and put it right
> in a list.
> However, I think I could solve my problem with the Carl's answer.
Yes, you should be able to do it with open.
Incidentally, there's a 'unique word in REBOL that may save you having
to check if your function names are in your list. It's behaviour
>> unique ["a" "b" "c" "a" "c"]
== ["a" "b" "c"]
so you could just add each function name to your block as you examine
the lines then when you've finished reading the file use unique to
strip out the duplicates from the block before you sort them.