diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-07-13 18:05:14 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-07-13 18:05:14 -0400 |
| commit | f64aaf5960287f776232f909e145ac3f72fec73c (patch) | |
| tree | 1f6d7d36ed58ca4219a1bb89e7f63aeadf8cf0bb /test | |
| parent | 445f79cb70e72698283539b65e43fc71a47ad311 (diff) | |
Add array:pairs()
Diffstat (limited to 'test')
| -rw-r--r-- | test/arrays.tm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/arrays.tm b/test/arrays.tm index fb6d16ca..ed43acb0 100644 --- a/test/arrays.tm +++ b/test/arrays.tm @@ -143,3 +143,16 @@ func main(): >> [i*10 for i in 10]:by(2):by(-1) = [90, 70, 50, 30, 10] + + do: + strs := ["A", "B", "C"] + >> ["{x}{y}" for x, y in strs:pairs()] + = ["AB", "AC", "BC"] + >> ["{x}{y}" for x, y in strs:pairs(self_pairs=yes)] + = ["AA", "AB", "AC", "BB", "BC", "CC"] + >> ["{x}{y}" for x, y in strs:pairs(ordered=yes)] + = ["AB", "AC", "BA", "BC", "CA", "CB"] + >> ["{x}{y}" for x, y in strs:pairs(self_pairs=yes, ordered=yes)] + = ["AA", "AB", "AC", "BA", "BB", "BC", "CA", "CB", "CC"] + >> ["!" for x,y in [:Text]:pairs()] + = [] |
