3 ms·
Maybe I'm an FP snob but it would have been nice to mention the analogy to set builder notation (though lists aren't sets - maybe multisets or bags) to indicate
by hatmatrix 11y ago
Maybe I'm an FP snob but it would have been nice to mention the analogy to set builder notation (though lists aren't sets - maybe multisets or bags) to indicate the existence of higher abstraction; not just syntactic sugar on the for-loop.
However, from a practical point of view I think it is great introduction for procedural programmers to begin using list comprehensions.
- deleted 11y ago[deleted]
- msellout 11y agocollections.Counter was designed with multiset in mind.
- dragonwriter 11y ago> though lists aren't sets - maybe multisets or bags arrays/lists (like maps/hashes, though with a more narrow restriction on the indices) are (or at least are isomorphic to) sets of pairs of (index, element). They carry information about order which does not exist in multisets/bags.