|
114 | 114 | (mut _output [])
|
115 | 115 |
|
116 | 116 | (while (< _index (len _L)) {
|
117 |
| - (if (_f (@ _L _index)) |
118 |
| - (append! _output (@ _L _index))) |
| 117 | + (if (_f (@ _L _index)) (append! _output (@ _L _index))) |
119 | 118 | (set _index (+ 1 _index)) })
|
120 | 119 | _output }))
|
121 | 120 |
|
|
169 | 168 | (while (< _index (len _L)) {
|
170 | 169 | (mut _sub (@ _L _index))
|
171 | 170 |
|
172 |
| - (if (= "List" (type _sub)) |
173 |
| - (concat! _output _sub) |
174 |
| - (append! _output _sub)) |
| 171 | + (if (= "List" (type _sub)) |
| 172 | + (concat! _output _sub) |
| 173 | + (append! _output _sub)) |
175 | 174 | (set _index (+ 1 _index)) })
|
176 | 175 | _output }))
|
177 | 176 |
|
|
191 | 190 | (while (< _index (len _L)) {
|
192 | 191 | (mut _res (_f (@ _L _index)))
|
193 | 192 |
|
194 |
| - (if (= "List" (type _res)) |
195 |
| - (concat! _output _res) |
196 |
| - (append! _output _res)) |
| 193 | + (if (= "List" (type _res)) |
| 194 | + (concat! _output _res) |
| 195 | + (append! _output _res)) |
197 | 196 | (set _index (+ 1 _index)) })
|
198 | 197 | _output }))
|
199 | 198 |
|
|
400 | 399 | # (print (iota 0 10)) # [0 1 2 3 4 5 6 7 8 9]
|
401 | 400 | # =end
|
402 | 401 | # @author https://github.com/SuperFola
|
403 |
| -(let iota (fun (_init _length) |
404 |
| - (iterate _init (fun (x) (+ 1 x)) _length))) |
| 402 | +(let iota (fun (_init _length) (iterate _init (fun (x) (+ 1 x)) _length))) |
405 | 403 |
|
406 | 404 | # @brief Chunk a list in sub-lists of size n
|
407 | 405 | # @param _L list to chunk
|
|
420 | 418 | (mut _i 0)
|
421 | 419 | (while (< _i _source_len) {
|
422 | 420 | (append! _current (@ _L _i))
|
423 |
| - (if (= (len _current) _length) |
424 |
| - { |
425 |
| - (append! _output _current) |
426 |
| - (set _current []) }) |
| 421 | + (if (= (len _current) _length) { |
| 422 | + (append! _output _current) |
| 423 | + (set _current []) }) |
427 | 424 | (set _i (+ 1 _i)) })
|
428 | 425 |
|
429 |
| - (if (not (empty? _current)) |
430 |
| - (append! _output _current)) |
| 426 | + (if (not (empty? _current)) (append! _output _current)) |
431 | 427 |
|
432 | 428 | _output }))
|
0 commit comments