# [erlang-questions] strange result of lists:map(fun(X)-> 20*X end, [2, 4, 6, 8]).

Work elbrujohalcon@REDACTED
Tue Dec 3 18:46:31 CET 2013

```Yeah, this should work:

io:format("~w~n", [lists:map(fun(X)-> 20*X end,L)]).

On Dec 3, 2013, at 14:41, Patrick Schless <patrick.schless@REDACTED> wrote:

> In cases like this, is there a way to explicitly show the result as numbers (as Hope expected)?
>
>
> On Tue, Dec 3, 2013 at 9:24 AM, Work <elbrujohalcon@REDACTED> wrote:
> Hi!
>
> 	Since strings in Erlang are just lists of integers, and the results of some of your tests are proper lists of strings, they’re *displayed* as strings.
> 	In other words "(Px?" = [40, 80, 120, 160]
> 	Hope that helps :)
> 	For reference, check this: http://learnyousomeerlang.com/starting-out-for-real#lists
>
> On Dec 3, 2013, at 12:13, <hope@REDACTED> <hope@REDACTED> wrote:
>
>> Hi,
>>
>> I am a beginner,  and I got some strange result like this :
>>
>> 1> L=[2,4,6,8].
>> [2,4,6,8]
>> 2> lists:map(fun(X)-> 20*X end,L).
>> "(Px?"
>> 3> lists:map(fun(X)-> 21*X end,L).
>> "*T~‥"
>> 4> lists:map(fun(X)-> 27*X end,L).
>> "6l¢O"
>> 5> lists:map(fun(X)-> 28*X end,L).
>> "8p‥a"
>> 6> lists:map(fun(X)-> 29*X end,L).
>> ":tRe"
>> 7> lists:map(fun(X)-> 30*X end,L).
>> "<x’e"
>> 8> lists:map(fun(X)-> 31*X end,L).
>> ">|oo"
>> 9> lists:map(fun(X)-> 32*X end,L).
>> [64,128,192,256]
>> 10> lists:map(fun(X)-> 22*X end,L).
>> [44,88,132,176]
>> 11> lists:map(fun(X)-> 23*X end,L).
>> [46,92,138,184]
>> 12> lists:map(fun(X)-> 24*X end,L).
>> [48,96,144,192]
>> 13> lists:map(fun(X)-> 25*X end,L).
>> [50,100,150,200]
>> 14> lists:map(fun(X)-> 26*X end,L).
>> [52,104,156,208]
>> 15> lists:map(fun(X)-> 27*X end,L).
>> "6l¢O"
>>
>> -------------------
>> Erlang R16B02 (erts-5.10.3) [smp:2:2] [async-threads:10]
>> Eshell V5.10.3 (abort with ^G)
>> -------------------
>> Windows Vista
>> -------------------
>>
>> Can someone help me ?
>>
>> Thanks a lot !
>>
>> best regards.
>>
>>
>> hope@REDACTED  2013.12.03
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131203/7866c9c0/attachment.htm>
```