aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQuinn Wilton <wilton@synopsys.com>2020-12-02 11:43:57 -0800
committerLouis Pilfold <louis@lpil.uk>2020-12-02 20:13:15 +0000
commitba19b9a9b57d8090c9224311bb86309d90cc424b (patch)
treeeea893ef8c35c931a51231fb8b3e5953f7db631a /src
parent88090877348a4f0c84b3ef497bab98a9a1e39e23 (diff)
downloadgleam_stdlib-ba19b9a9b57d8090c9224311bb86309d90cc424b.tar.gz
gleam_stdlib-ba19b9a9b57d8090c9224311bb86309d90cc424b.zip
Add bool.nand
Diffstat (limited to 'src')
-rw-r--r--src/gleam/bool.gleam25
1 files changed, 25 insertions, 0 deletions
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