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

[REBOL] Speed and Memory Management in REBOL Re:

From: ryanc:iesco-dms at: 5-Sep-2000 13:47

[princepawn--lycos--com] wrote:
> I was glancing at one of the most popular scripts at the REBOL archive and developed some questions: > > 1- Is it possible to incrementally write to a file in REBOL?
autos: open/new %autos.txt insert autos "Ford" insert tail autos " Chevy" close autos
> 2- Is it possible to append to a file in REBOL
write/append %test.txt "test"
> 3- This script seems in-efficient and memory wasteful: it reads and entire file into a temporary array and then converts the array. In Perl, I could do each conversion as I read in each line and write each line out after each conversion. > > REBOL [ > Title: "Comma-Seperated-Values to REBOL converter" > Date: 16-Jun-1999 > Author: "Bohdan Lechnowsky" > Email: [bo--rebol--com] > File: %convert-csv.r > Purpose: { > Convert CSV files to REBOL blocks > } > Category: [file util db text 2] > ] > > csv: read/lines to-file ask "Filename to convert from CSV: " > > block: make block! 100 > > headings: parse/all first csv "," > > foreach line next csv [append block parse/all line ","] > > save to-file ask "Filename to save to: " head insert/only block headings > > Get your FREE Email and Voicemail at Lycos Communications at > http://comm.lycos.com
Go get em. --Ryan * Ryan Cole * Programmer Analyst www.iesco-dms.com 707-468-5400 ;Fortuneately escape will cancel this endless loop... Forever [ buy microsoft version: version + 1 ]