diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-05-10 14:31:53 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-05-10 14:31:53 +0100 |
commit | 8fb5ad85ab623f93cfc0670bc11ec12856a9b4cd (patch) | |
tree | 6fa6a7acf4652ec546385f9e433488b2821a7698 /gen/src/bool.erl | |
parent | dd4c4d9e0e45a487f89cf98bfc24855990e4a8a5 (diff) | |
download | gleam_stdlib-8fb5ad85ab623f93cfc0670bc11ec12856a9b4cd.tar.gz gleam_stdlib-8fb5ad85ab623f93cfc0670bc11ec12856a9b4cd.zip |
bool:compare
Diffstat (limited to 'gen/src/bool.erl')
-rw-r--r-- | gen/src/bool.erl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gen/src/bool.erl b/gen/src/bool.erl index e4e1108..47fba5d 100644 --- a/gen/src/bool.erl +++ b/gen/src/bool.erl @@ -1,7 +1,7 @@ -module(bool). -compile(no_auto_import). --export([negate/1, max/2, min/2, to_int/1]). +-export([negate/1, compare/2, max/2, min/2, to_int/1]). negate(Bool) -> case Bool of @@ -12,6 +12,21 @@ negate(Bool) -> true end. +compare(A, B) -> + case {A, B} of + {true, true} -> + eq; + + {true, false} -> + gt; + + {false, false} -> + eq; + + {false, true} -> + lt + end. + max(A, B) -> case A of true -> |