API
MixedSet
The MixedSet module offers functionality for creating mixed sets, which are sets that can contain both discrete and continuous values.
Discrete values are represented as points, while continuous values are represented as ranges. Mixed sets are particularly useful for describing the support of mixed probability distributions.
The majority of set functions in the MixedSet module are designed to mirror the upcomming set functions in Javascript.
The primary purpose of mixed sets in Squiggle is to facilitate scoring. For instance, by utilizing mixed sets, you can easily determine if one distribution covers the support of another distribution. If it doesn't, it may be prone to receiving a score of negative infinity.
Currently, there is no dedicated MixedSet object type. Instead, mixed sets are implemented as dictionaries, where discrete values are stored as points and continuous values are stored as segments.
MixedSet.difference({points: List(Number), segments: List([Number, Number])}, {points: List(Number), segments: List([Number, Number])}) => {points: List(Number), segments: List([Number, Number])}
MixedSet.intersection({points: List(Number), segments: List([Number, Number])}, {points: List(Number), segments: List([Number, Number])}) => {points: List(Number), segments: List([Number, Number])}
MixedSet.union({points: List(Number), segments: List([Number, Number])}, {points: List(Number), segments: List([Number, Number])}) => {points: List(Number), segments: List([Number, Number])}
MixedSet.isSubsetOf({points: List(Number), segments: List([Number, Number])}, {points: List(Number), segments: List([Number, Number])}) => Bool
MixedSet.isSupersetOf({points: List(Number), segments: List([Number, Number])}, {points: List(Number), segments: List([Number, Number])}) => Bool
MixedSet.isEqual({points: List(Number), segments: List([Number, Number])}, {points: List(Number), segments: List([Number, Number])}) => Bool
MixedSet.isEmpty({points: List(Number), segments: List([Number, Number])}) => Bool
Returns the minimum value in the set
MixedSet.min({points: List(Number), segments: List([Number, Number])}) => Number
Returns the maximum value in the set
MixedSet.max({points: List(Number), segments: List([Number, Number])}) => Number