A silly question, I just learned that Lists are not linked lists, but are arrays underneath. Why aren't they called Array then?
Cause they are not static and still allocated on the heap. So equivalent to Vector types in rust or C++. Or ArrayList in java.
Oh! I read this in the docs and assumed it's always a continuous piece of memory:
Under the hood, a list is a record containing a len : Nat field, a capacity : Nat field, and a pointer to a reference count and a flat array of bytes.
Michał Łępicki has marked this topic as resolved.
Yeah the pointed to list is a continuous piece of memory. That is the same a C++ vector.
unfortunately, all of these terms are pretty overloaded - e.g. Array in C and Rust means the length is hardcoded at compile time, whereas in JS and Ruby it means the length varies at runtime
List in Elm means linked list, whereas in Java it means "sequence of elements" and in Python it means what it means in Roc
I like List (as Python uses it) for this because:
Last updated: Jul 06 2025 at 12:14 UTC