Stream: beginners

Topic: ✔ Why is List not called Array?


view this post on Zulip Michał Łępicki (Oct 16 2022 at 16:56):

A silly question, I just learned that Lists are not linked lists, but are arrays underneath. Why aren't they called Array then?

view this post on Zulip Brendan Hansknecht (Oct 16 2022 at 17:00):

Cause they are not static and still allocated on the heap. So equivalent to Vector types in rust or C++. Or ArrayList in java.

view this post on Zulip Michał Łępicki (Oct 16 2022 at 17:04):

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.

view this post on Zulip Notification Bot (Oct 16 2022 at 17:05):

Michał Łępicki has marked this topic as resolved.

view this post on Zulip Brendan Hansknecht (Oct 16 2022 at 17:16):

Yeah the pointed to list is a continuous piece of memory. That is the same a C++ vector.

view this post on Zulip Richard Feldman (Oct 16 2022 at 17:31):

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

view this post on Zulip Richard Feldman (Oct 16 2022 at 17:32):

List in Elm means linked list, whereas in Java it means "sequence of elements" and in Python it means what it means in Roc

view this post on Zulip Richard Feldman (Oct 16 2022 at 17:36):

I like List (as Python uses it) for this because:


Last updated: Jul 06 2025 at 12:14 UTC