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.

418993 (2) [Avatar] Offline
#1
Hello,

I'm reading Chapter 1 of Elm_in_Action_v2_MEAP and I'm a bit confused about the question in the title. In my view, as List cannot be changed, why it has variable length then?
9821 (4) [Avatar] Offline
#2
A tuple's length is part of its type. If your function takes a (Int, Int) tuple then the only thing I can past to your function is two Ints. However if it takes a List of Ints then I can pass a List of any length to it.

It's also possible to add a new value in front of a list (yielding a new list) or concat two lists together (also yielding a new list) which is also impossible to do with tuples.
418993 (2) [Avatar] Offline
#3
"A tuple's length is part of its type." This makes sense. Thanks.