[clean-list] term reading and writing
HP Wei
hp at rentec.com
Tue Apr 29 21:09:21 MEST 2008
Newbie questions--
Suppose there is a data type,
:: Person = { name :: String,
id :: (Int, String),
flag :: Bool }
Suppose a file whose name is fname.txt
has the following content:
{ name = "a_name",
id = (123, "an_id"),
flag = True }
-----------------------------------
Q1: how do I 'read in' a Person from fname.txt ?
[ i.e.
If person is of type Person,
person = _read_ "fname.txt"
is there a built-in fx that does the above _read_ ?
Or shall I need to write a parse-fx to do this ?
Q2: if person = {name ="xyz",
id = (456, "id"),
flag = False}
how do I _print_ this 'person' to a text file
fname1.txt ?
*** for those who knows Erlang, Q1 and Q2 are term
reading and writing.
THanks
HP
More information about the clean-list
mailing list