Set comprehensions
robrix opened this issue ยท 2 comments
e.g. some syntax to match the typical set-builder notation of { ๐ฅ โ ๐ด | proposition(๐ฅ) }
.
This is probably infeasible with the extant Dictionary
-based Set
(since it trivially lends itself to infinite sets, and in general should be lazy), but a SetType
protocol could allow us to abstract the notion of sets appropriately for this purpose.
It would likely also be necessary to distinguish between Set
and MutableSet
at that point, since a set comprehension stored in a var
is probably still immutable.
It may be valuable to consider set comprehensions as inductive construction of sets rather than as filtering of some domain set. Likewise, it may be valuable to consider the proposition not as a predicate but as a flat map, since that allows us to recover both maps and filters.
๐ฅ