Anthony Borla wrote:
I'm using the following approach to read in a redirected text file from
stdin:
...{New TextFile init(name:stdin)}...
...
fun {LoadData FILE DATATBL}
case {FILE getS($)} of false then
DATATBL
elseof DATUM then
{LoadData FILE {Append DATATBL [{String.toFloat DATUM}]}}
end
end
...
Just a side note: your function builds a list of size n in O(n^2)
complexity! The following does the same in O(n):
fun {LoadData FILE}
case {FILE getS($)}
of false then nil
[] DATUM then {String.toFloat DATUM}|{LoadData FILE}
end
end
Regarding your problem, I don't remember to have read something similar
in the past. Have you checked the mailing list archives? BTW, you can
remove spurious CR in the line you read with String.tokens.
Cheers,
raph
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users