Summing a number to the terms of a list
Ulf Wiger (ÄL2/EAB)
Tue Aug 12 16:58:08 CEST 2003
The shell guesses that the first two results are
strings, as they are lists of numbers in the ASCII
range. The third list contains numbers greater than
255, and is thus not formatted as a string.
This is a consequence of the fact that erlang lacks
a string data type. It's only a presentation issue.
Try e.g. io:format("~w~n", [sumit:sum_me(A,100)]).
From: Jilani Khaldi [mailto:jilani.khaldi@REDACTED]
Sent: Tuesday, August 12, 2003 16:37
Subject: Summing a number to the terms of a list
Why this code gives me these different results?
sum_me(H|T,X) -> [(H+X)|sum_me(T,X)];
sum_me(, X) -> .
[301,302,303] -- as I expected.
More information about the erlang-questions