|
50 | 50 | # (list:slice1 [1 2 3 4 5] 1 3) # [2 3 4] |
51 | 51 | # =end |
52 | 52 | # @author https://github.com/SuperFola |
| 53 | +# @require 4.6.0 Requires ArkScript 4.6.0 or later |
53 | 54 | (let slice1 (fun (_L _start _end) (builtin__slice _L _start _end 1))) |
54 | 55 |
|
55 | 56 | # @brief Sort a List and return a new one |
|
76 | 77 | # (list:zeros 4) # [0 0 0 0] |
77 | 78 | # =end |
78 | 79 | # @author https://github.com/SuperFola |
| 80 | +# @require 4.6.0 Requires ArkScript 4.6.0 or later |
79 | 81 | (let zeros (fun (_count) (builtin__list:fill _count 0))) |
80 | 82 |
|
81 | 83 | # @brief Generate a List of n ones |
|
84 | 86 | # (list:ones 4) # [1 1 1 1] |
85 | 87 | # =end |
86 | 88 | # @author https://github.com/SuperFola |
| 89 | +# @require 4.6.0 Requires ArkScript 4.6.0 or later |
87 | 90 | (let ones (fun (_count) (builtin__list:fill _count 1))) |
88 | 91 |
|
89 | 92 | # @brief Modify a given list and return a new one |
|
177 | 180 | # (let p (list:cumulativeProduct collection)) # => [1 2 6 24] |
178 | 181 | # =end |
179 | 182 | # @author https://github.com/SuperFola |
| 183 | +# @require 4.6.0 Requires ArkScript 4.6.0 or later |
180 | 184 | (let cumulativeProduct (fun ((ref _L)) { |
181 | 185 | (mut _index 0) |
182 | 186 | (mut _output []) |
|
213 | 217 | # (let p (list:cumulativeSum collection)) # => [1 3 8 20] |
214 | 218 | # =end |
215 | 219 | # @author https://github.com/SuperFola |
| 220 | +# @require 4.6.0 Requires ArkScript 4.6.0 or later |
216 | 221 | (let cumulativeSum (fun ((ref _L)) { |
217 | 222 | (mut _index 0) |
218 | 223 | (mut _output []) |
|
450 | 455 | # (print (list:first [1 2 3 4 5 6 7 8 9] 4)) # [1 2 3 4] |
451 | 456 | # =end |
452 | 457 | # @author https://github.com/SuperFola |
| 458 | +# @require 4.6.0 Requires ArkScript 4.6.0 or later |
453 | 459 | (let first (fun ((ref _L) _n) |
454 | 460 | (if (<= (len _L) _n) |
455 | 461 | _L |
|
463 | 469 | # (print (list:last [1 2 3 4 5 6 7 8 9] 4)) # [6 7 8 9] |
464 | 470 | # =end |
465 | 471 | # @author https://github.com/SuperFola |
| 472 | +# @require 4.6.0 Requires ArkScript 4.6.0 or later |
466 | 473 | (let last (fun ((ref _L) _n) |
467 | 474 | (if (<= (len _L) _n) |
468 | 475 | _L |
|
0 commit comments