4 ms·
Erlang is a functional language; functional languages are different. They really need proper linked lists as a built-in default "list" data structure.
by theseoafs 12y ago
Erlang is a functional language; functional languages are different. They really need proper linked lists as a built-in default "list" data structure.
- SideburnsOfDoom 12y agoRight. Is that because functional languages prefer immutable data structures? e.g. cdr/ tail / list.skip(1) are easier and simpler if you can just return the first element's next pointer rather than copying an array.
- theseoafs 12y agoYes, that's the idea. ArrayLists don't work well at all if you want persistent data structures as your language's default. Also arrays are less sensible for pattern-matching. (Note that most functional languages offer normal stateful arrays as an option, if they're necessary; interestingly, Erlang does not.)