From 88090877348a4f0c84b3ef497bab98a9a1e39e23 Mon Sep 17 00:00:00 2001 From: Quinn Wilton Date: Wed, 2 Dec 2020 11:39:09 -0800 Subject: Add bool.nor --- src/gleam/bool.gleam | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/gleam/bool.gleam b/src/gleam/bool.gleam index 0792057..707d295 100644 --- a/src/gleam/bool.gleam +++ b/src/gleam/bool.gleam @@ -30,6 +30,31 @@ pub fn negate(bool: Bool) -> Bool { } } +/// Returns the nor of two bools +/// +/// ## Examples +/// +/// > nor(False, False) +/// True +/// +/// > nor(False, True) +/// False +/// +/// > nor(True, False) +/// False +/// +/// > nor(True, True) +/// False +/// +pub fn nor(a: Bool, b: Bool) -> Bool { + case a, b { + False, False -> True + False, True -> False + True, False -> False + True, True -> False + } +} + /// Returns the exclusive or of two bools /// /// ## Examples -- cgit v1.2.3