remove type checking for sort
@@ -254,16 +254,14 @@ $.assert(arr == [5, 5, 3, 2, 1])
}
// uses quick sort
- if self.all(item => item.type == @number) {
+ // no type checking becuase theoretically this can sort anything if it hasthe right comparator
+ // if sort was overloaded we could have two seperate implementations
if begin < new_end {
let q = self._partition(low = begin, high = new_end, key = key)
self.sort(begin = begin, end = q-1, key = key)
self.sort(begin = q+1, end = new_end, key = key)
}
- } else {
- throw "Unsupported type in array " + self as @string
- }
},
sorted: #[desc("Returns a sorted verison of the array") example("
