Getting lists from ASCII input

Mats Cronqvist mats.cronqvist@REDACTED
Tue May 16 10:13:52 CEST 2006

Deryk Barker wrote:
> I'm still a (raw) beginner but...
> I'm trying to write a program (a client - my students will write the
> server) which needs to allow the user to enter a list in repsonse to a
> prompt.

   seems like a problem where using the scanner directly would be appropriate.

1> erl_scan:string("hello [a,b,c]").

   perhaps parse the arg;

1> {ok,[{atom,_,Cmd}|R],_} = erl_scan:string("hello,[a,b,c]"),
2> {ok,Arg}=erl_parse:parse_term(R++[{dot,1}]),
3> {Cmd,Arg}.


More information about the erlang-questions mailing list