[clean-list] Reading Files in Clean
Siegfried Gonzi
siegfried.gonzi@kfunigraz.ac.at
Fri, 24 Aug 2001 11:41:19 +0200
Is there a fast an cute way to read the following file structure:
Ich bin der beste...
Daher waehlt mich,....
Date,Time, Mess1,Mess2,Mess3
03:04:2001,12:34:34,2.345,45.67
04:04:2001,14:56:34,3.45,23.45
The first 3 lines are strings.
The Clean book discusses "nested scopes" (zip-example) but I am not sure how I cann read the values in. Prefered in lists or maybe arrays (because the file has many thousands of values in it):
list date1...should be day: [3,4..]
list date2...should be month: [4,4,...]
list date3...should be year: [2001,2001,...]
list time1...should be hour: [12,14,..]
list time2...should be minutes: [34,34,..]
list time3...should be seconds: [34,34,...]
list mess1...should be :[2.345,3.45,...]
list mess2...should be:,[45.67, 23.45,...]
The Clean language-report only points to the I/O tutorial. But the I/O tutorial is more about GUIs. "StdFile.dcl" is a little bit of help, but no examples.
In C I would use "scanf" with the appropiate format-conversions in a loop. But how in Clean. I think such an example is of interest for all. What about the commas in the file?
S. Gonzi