aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gleam/pair.gleam10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gleam/pair.gleam b/src/gleam/pair.gleam
index 9074330..32fc6d1 100644
--- a/src/gleam/pair.gleam
+++ b/src/gleam/pair.gleam
@@ -17,3 +17,13 @@ pub fn swap(tup) {
let Pair(a, b) = tup
Pair(b, a)
}
+
+pub fn map_first(tup, f) {
+ let Pair(a, b) = tup
+ Pair(f(a), b)
+}
+
+pub fn map_second(tup, f) {
+ let Pair(a, b) = tup
+ Pair(a, f(b))
+}