how to get [3,5] from [ ["3"], ["5"] ] - it works! i used string:to_integer

Mikael Karlsson <>
Sun Aug 7 20:56:04 CEST 2005


Or with list comprehensions:
17> A.
[{["3"],["red"]},{["5"],["yellow"]}]
18> [list_to_integer(X) || {[X],_} <- A].
[3,5]

- Mikael

söndag 07 augusti 2005 19:25 skrev Per Hedeland:
..

> 8> F = fun({[S],_}) -> list_to_integer(S) end.
> #Fun<erl_eval.6.39074546>
> 9> lists:map(F,[{["3"],["red"]},{["5"],["yellow"]}]).
> [3,5]
>
> --Per Hedeland




More information about the erlang-questions mailing list