DEV Community


Discussion on: De-throning the List: Part SC4K

mcapodici profile image
Martin Capodici

Funnily enough it is called ArrayList in C#1.0.

That type is still there, although most will now opt to use the newer List<> which is a generic type.

Once everyone is conditioned to think "A list is an array" it's OK for Microsoft to shorten the name in the newer type.

In Elm LinkedList would be a good type name to avoid confusion.

To me it doesn't feel like a stack. I mean technically it is. But then what's with the (++) operation? That's a weird operator for stacks, right? It feels weird to use any infix and would rather have definitions like this:

push : a -> Stack a -> Stack a
peek : Stack a -> Maybe a
pop : Stack a -> (a, Stack a)

Thread Thread
robinheghan profile image
Robin Heggelund Hansen Author

You’re right, (++) is not an efficient operation for a single-linked-list, and so one could make a (good, in my oppinion) argument for it’s removal.

Thing is, Haskell’s List also has (++), and Elm hasn’t had a stable Array implementation (it gets one in 0.19).

If my proposal is accepted, it would make sense to remove bad operations from List.