diff options
author | Quinn Wilton <wilton@synopsys.com> | 2020-12-02 11:33:39 -0800 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2020-12-02 20:13:15 +0000 |
commit | e3178fb8d056b2e55f0baa041be313d9c4bd1ff4 (patch) | |
tree | 494ca462749ee2093bc2fe07c22f1f0b6d97b9c8 /src | |
parent | 32d9d1622940323ec41ae991a62cf82427e16561 (diff) | |
download | gleam_stdlib-e3178fb8d056b2e55f0baa041be313d9c4bd1ff4.tar.gz gleam_stdlib-e3178fb8d056b2e55f0baa041be313d9c4bd1ff4.zip |
Add bool.exclusive_nor
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/bool.gleam | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gleam/bool.gleam b/src/gleam/bool.gleam index e5b079f..0792057 100644 --- a/src/gleam/bool.gleam +++ b/src/gleam/bool.gleam @@ -55,6 +55,31 @@ pub fn exclusive_or(a: Bool, b: Bool) -> Bool { } } +/// Returns the exclusive nor of two bools +/// +/// ## Examples +/// +/// > exclusive_nor(False, False) +/// True +/// +/// > exclusive_nor(False, True) +/// False +/// +/// > exclusive_nor(True, False) +/// False +/// +/// > exclusive_nor(True, True) +/// True +/// +pub fn exclusive_nor(a: Bool, b: Bool) -> Bool { + case a, b { + False, False -> True + False, True -> False + True, False -> False + True, True -> True + } +} + /// Compares two bools and returns the first values Order to the second. /// /// ## Examples |