The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

254628 (1) [Avatar] Offline
#1
My solution of range/2 was sometimes giving strings not integers in IEx, which was a bit confusing. I loaded the reference solution and it did the same.

iex(3)> RecursionPracticeTc.range(10,13)
'\n\v\f\r'

iex(5)> RecursionPracticeTc.range(11,15)
[11, 12, 13, 14, 15]



Simplifying everything I tried

iex(8)> [10]
'\n'
iex(9)> [15]
[15]


I reread the strings section in 2.4.8 and the answer was there...
even the runtime doesn't distinguish between a list of integers and a character list. When a list consists of integers that represent printable characters, it's printed to the screen in string form.





sjuric (109) [Avatar] Offline
#2
Yes, this is a common pitfall for people arriving to Erlang smilie

For the next edition, I'll consider including a reminder about that issue in the recursion section.