Skip to content

Commit 1cfa597

Browse files
committed
std: Fix a bug in Tuple::equals and Fixed the implementation of Tuple::toString
1 parent 0b7ff57 commit 1cfa597

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

std/tuple/tuple.pics

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11

2+
import std.array
3+
4+
25
// Module: Tuple
36
// Provides utility functions for working with 2-element tuples (pairs).
47
// Includes size inspection, mapping, zipping, comparisons, and conversions.
@@ -82,7 +85,7 @@ Tuple :: module {
8285
// true if both tuples have the same elements in the same order, else false
8386
equals :: (t1=(0, 0), t2=(0, 0)) =
8487
when [t1, t2] {
85-
is [(a1, b1), (a2, b2)] -> (a1 == a2 and b1 == b2)
88+
is [(a1, b1), (a2, b2)] -> (a1 == a2) && (b1 == b2)
8689
}
8790

8891

@@ -94,10 +97,7 @@ Tuple :: module {
9497
//
9598
// Returns:
9699
// String: "(a, b)" where a and b are the string representations of the tuple elements
97-
toString :: (tup=(0, 0)) =
98-
when tup {
99-
is (a, b) -> "(" + a + ", " + b + ")"
100-
}
100+
toString :: (tup=(0, 0)) = Array::toString(Tuple::toArray(tup))
101101

102102
}
103103

0 commit comments

Comments
 (0)