aboutsummaryrefslogtreecommitdiff
path: root/src/tuple.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'src/tuple.gleam')
-rw-r--r--src/tuple.gleam23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tuple.gleam b/src/tuple.gleam
new file mode 100644
index 0000000..d437a9f
--- /dev/null
+++ b/src/tuple.gleam
@@ -0,0 +1,23 @@
+import expect
+
+pub fn first(tup) {
+ let {a, _} = tup
+ a
+}
+
+test first {
+ {1, 2}
+ |> first
+ |> expect:equal(_, 1)
+}
+
+pub fn second(tup) {
+ let {_, a} = tup
+ a
+}
+
+test second {
+ {1, 2}
+ |> second
+ |> expect:equal(_, 2)
+}