You're talking about my interest in renaming List to Stack?
Generally understood amongst whom? Most people who come to Elm come from JS. Depending on what other language they have experience with, List is a very ambiguous term. In python and C#, List actually refers to Array. Also, when a JS developer sees [1, 2, 3] it's reasonable to expect List to work as an Array.
Stack is not only more descriptive of what performance one can expect, it also avoids confusion. While List often means linked list in other functional languages, most people new to Elm have no experience with other functional languages, and so they are more likely to expect that List works like an Array.
You're talking about my interest in renaming List to Stack?
Yep.
Generally understood amongst whom?
I probably could have phrased it better: Those who work in functional languages tend to have a less ambiguous understanding of what a list is, and are unlikely to conflate linked lists with arrays or array-backed lists.
A more pragmatic approach to introducing people to functional languages is to make this distinction clear to them from the start, as opposed to introducing ambiguous terminology in the one paradigm where little ambiguity exists for these terms.
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)
You're talking about my interest in renaming
ListtoStack?Generally understood amongst whom? Most people who come to Elm come from JS. Depending on what other language they have experience with,
Listis a very ambiguous term. In python and C#,Listactually refers toArray. Also, when a JS developer sees[1, 2, 3]it's reasonable to expectListto work as anArray.Stackis not only more descriptive of what performance one can expect, it also avoids confusion. WhileListoften means linked list in other functional languages, most people new to Elm have no experience with other functional languages, and so they are more likely to expect thatListworks like anArray.Yep.
I probably could have phrased it better: Those who work in functional languages tend to have a less ambiguous understanding of what a list is, and are unlikely to conflate linked lists with arrays or array-backed lists.
A more pragmatic approach to introducing people to functional languages is to make this distinction clear to them from the start, as opposed to introducing ambiguous terminology in the one paradigm where little ambiguity exists for these terms.
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)
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
Listalso has (++), and Elm hasn’t had a stableArrayimplementation (it gets one in 0.19).If my proposal is accepted, it would make sense to remove bad operations from
List.