Erlang Central

List to term

Revision as of 05:09, 28 July 2009 by Flodis (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

There is not a list_to_term() function, but it easy to write one yourself.

list_to_term(String) ->
    {ok, T, _} = erl_scan:string(String++"."),
    case erl_parse:parse_term(T) of
        {ok, Term} ->
            Term;
        {error, Error} ->
            Error
    end.