aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/arrays.tm7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/arrays.tm b/test/arrays.tm
index d4dd2119..60bdc69a 100644
--- a/test/arrays.tm
+++ b/test/arrays.tm
@@ -76,9 +76,16 @@ if yes
if yes
>> nums := [10, -20, 30]
+ // Sorted function doesn't mutate original:
+ >> nums:sorted()
+ = [-20, 10, 30]
+ >> nums
+ = [10, -20, 30]
+ // Sort function does mutate in place:
>> nums:sort()
>> nums
= [-20, 10, 30]
+ // Custom sort functions:
>> nums:sort(func(x:&%Int,y:&%Int) x:abs() <> y:abs())
>> nums
= [10, -20, 30]