3 ms·
Erlang also. In most functional languages using list indices are an anti-pattern. Pattern matching and generalized iteration is a much more elegant way to hand
by runchberries 10y ago
Erlang also.
In most functional languages using list indices are an anti-pattern. Pattern matching and generalized iteration is a much more elegant way to handle most things you would use an index for.
- lostcolony 10y agoWell, sort of. Erlang has the array module, which does actually index at 0, intentionally to feel like an array from another language. The primitive collection types index at 1, but, as you said, are almost never indexed that way. I'm not sure the motivation as to why, but the fact it feels clunky to use them that way is a benefit, as it raises resistance when you're using them wrong (as indexing them almost always is).