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

[REBOL] Re: Creating a list, writing it in a file

From: carl:cybercraft at: 12-Apr-2002 20:17

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. > Purpose: > 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 is...
>> 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. -- Carl Read