rescript-core icon indicating copy to clipboard operation
rescript-core copied to clipboard

Option existential quantifiers

Open jmagaram opened this issue 1 year ago • 3 comments

This adds two functions - Option.isSomeAnd and Option.isNoneOr. Full and really good documentation and tests. These are convenience functions that lead to shorter and easier-to-understand code. These correspond to the quantifiers "forAll" and "exists" in mathematics. We have analogous functions on the Array module.

isSomeAnd is like Array.some. Another common name is exists. But I like the parallel usage here.

isNoneOr is like Array.every. Another common name is forAll. But I and other people find this naming a little confusing for empty collections. For every PR I've received money for, I got $1 million dollars. Technically true.

Rust discussion on isSomeAnd: https://github.com/rust-lang/rust/issues/93050 F#: https://fsharp.github.io/fsharp-core-docs/reference/fsharp-core-optionmodule.html

jmagaram avatar Mar 24 '23 19:03 jmagaram