diff options
author | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2023-07-23 21:53:21 +0200 |
---|---|---|
committer | Tomasz Chojnacki <tomaszchojnacki2001@gmail.com> | 2023-07-23 21:53:21 +0200 |
commit | f5a3414d089bbfc06c6afe4f2e083600fd229dc5 (patch) | |
tree | 712fbceed808890cea253280243a48910f4db87c /aoc-2020-gleam/src/ext | |
parent | 5d478156035921ef4ca4bba204a0e7a29d72e56e (diff) | |
download | gleam_aoc2020-f5a3414d089bbfc06c6afe4f2e083600fd229dc5.tar.gz gleam_aoc2020-f5a3414d089bbfc06c6afe4f2e083600fd229dc5.zip |
Solve day 22
Diffstat (limited to 'aoc-2020-gleam/src/ext')
-rw-r--r-- | aoc-2020-gleam/src/ext/boolx.gleam | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/aoc-2020-gleam/src/ext/boolx.gleam b/aoc-2020-gleam/src/ext/boolx.gleam new file mode 100644 index 0000000..f3c8b49 --- /dev/null +++ b/aoc-2020-gleam/src/ext/boolx.gleam @@ -0,0 +1,10 @@ +pub fn guard_lazy( + when requirement: Bool, + return consequence: fn() -> t, + otherwise alternative: fn() -> t, +) -> t { + case requirement { + True -> consequence() + False -> alternative() + } +} |