From ba19b9a9b57d8090c9224311bb86309d90cc424b Mon Sep 17 00:00:00 2001 From: Quinn Wilton Date: Wed, 2 Dec 2020 11:43:57 -0800 Subject: Add bool.nand --- 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 707d295..0aa9939 100644 --- a/src/gleam/bool.gleam +++ b/src/gleam/bool.gleam @@ -55,6 +55,31 @@ pub fn nor(a: Bool, b: Bool) -> Bool { } } +/// Returns the nand of two bools +/// +/// ## Examples +/// +/// > nor(False, False) +/// True +/// +/// > nor(False, True) +/// True +/// +/// > nor(True, False) +/// True +/// +/// > nor(True, True) +/// False +/// +pub fn nand(a: Bool, b: Bool) -> Bool { + case a, b { + False, False -> True + False, True -> True + True, False -> True + True, True -> False + } +} + /// Returns the exclusive or of two bools /// /// ## Examples -- cgit v1.2.3