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

[REBOL] Re: files out of order

From: brett:codeconscious at: 30-Mar-2001 12:36

> read-directory-messages: func [ > "Read a directory of XML-formatted standard messages with the
directory
> determined by messageType." > message-directory [block!] "A block of file names corresponding to a > directory of XML-formatted standard messages." > ][ > message-block: copy [] > foreach file-name message-directory [ > file-contents: read file-name > insert message-block file-contents > ] > ] > > But using the above function, I get files showing up in the block out of > order. Am I doing something wrong?
I suspect all you need is to sort the message-directory block. Probably as simply as adding the following line sort message-directory You'll get your messages in reverse order because you are inserting at the head of the block each time. Alternatively, after sorting do the foreach on the "head reverse" of the message block and insert at the tail of your result. Brett.