Guest
On Feb 13, 4:01 pm, ri...@galaxy.nsc.com wrote:
I found the problem, I had an empty line at the end that was causing
the error
On Feb 11, 12:31 pm, "S. Badel" <stephane.ba...@REMOVETHISepfl.ch
wrote:
procedure( ReadMetaData( @key (file "./META") )
let( (port x)
The following line opens the file for reading
port = infile( file )
Here, it loops for each line until lineread returns nil (end of file)
lineread parses the input as SKILL list, so when the line is in the form
SOME_NAME "some text"
the first word is recognized as a symbol, since it's not quoted, and the second part is parsed as a
text string because it is quoted. More elements could follow, and they would we returned as well but
in the following code they would be ignored anyway.
while( x = lineread( port )
here the second element read from the file (cadr(x)) is assigned to the symbol read as the first
element in the line (cadr(x)). It's exactly as if you were doing
SOME_NAME = "some text"
or, equivalently
set( 'SOME_NAME "some text" )
set(car(x) cadr(x))
) ; while
Close the file and, that's it...
close( port )
) ; let
) ; procedure
(Here you see an example of how a user might mess with the file... Imagine the first element was
quoted as "SOME_NAME", lineread would parse it as a string and set() would fail because it expects a
symbol as first argument.)
Cheers,
Stéphane
Can you please give a brief description on how to use it. I tried a
few things and it either gave an error or just stared at me.
Thanks!!!!
I found the problem, I had an empty line at the end that was causing
the error