I when I use the code:
Enum.to_list 9..12
The following gets returned instead of a list:
'\t\n\v\f'
It seems to only happen with these specific numbers. Is this a bug? Or am I missing something?
I when I use the code:
Enum.to_list 9..12
The following gets returned instead of a list:
'\t\n\v\f'
It seems to only happen with these specific numbers. Is this a bug? Or am I missing something?
I believe Binaries, strings and char lists in the getting-started documentation covers everything you need to understand what's going on here.
If all of the values in a list fall within the range of ASCII code points, then IEx will display the result as a character list. \t
is ASCII value 9, \n
is 10, and so on.
Here's another example:
iex> Enum.to_list 65..70
'ABCDEF'