Read terms from the command line (answer)

Martin J. Logan <>
Wed Feb 18 20:42:41 CET 2004


I guess that I will answer my own question FYI. The way to convert
strings to terms is in the following manner. This is well documented by
the way:( shame on me. The first thing to do is


{ok, Toks, Line} = erl_scan:string("[[logan], {martin}]. ", 1).

The term should end in a "." followed by whitespace.

erl_parse:parse_term(Toks). 

This returns 

{ok,[[logan],{martin}]}

beautiful...

Cheers,
Martin


On Tue, 2004-02-17 at 12:58, Martin J. Logan wrote:
> Anyone know how to read erlang terms off the command line. Specifically
> I would like to call an erlang function via erl -s or something similar
> and pass the function terms. Does anyone know of a method to "consult"
> chars passed in from the command line.
> 
> 
> Martin




More information about the erlang-questions mailing list