removed  function
@@ -180,13 +180,6 @@ $.assert(arr.sum() == 15)
(self) {
return self.reduce((acum, el) => acum + el)
},
- copy: #[desc("Returns a shallow copy of the array") example("
-arr = [5, 6, 7]
-assert(arr == arr.copy())
- ")]
- (self) {
- return self.map(x => x)
- },
_partition: #[desc("Private function needed for .sort()")]
(self, low: @number, high: @number, key: @macro = (a, b) => a <= b) {
@@ -217,7 +210,7 @@ arr = [5, 1, 5, 3, 2]
arr.sort(key = (a, b) => a > b)
$.assert(arr == [5, 5, 3, 2, 1])
")]
- (self, begin: @number = 0, end: @number = -1, key: @macro = (a, b) => a <= b, ) {
+ (self, begin: @number = 0, end: @number = -1, key: @macro = (a, b) => a <= b) {
// when end == -1, that means the end of the array, but comparing to -1 doesnt work so switch it back to legnth - 1
let new_end = end
@@ -243,7 +236,7 @@ $.assert(arr.sorted(begin = 2, end = 4) == [5, 1, 2, 3, 5])
$.assert(arr.sorted(key = (a, b) => a >= b) == [5, 5, 3, 2, 1])
")]
(self) {
- let new_arr = self.copy()
+ let new_arr = self
new_arr.sort()
return new_arr
