File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 450450# (let a [1 2 3])
451451# (print (list:partition a (fun (c i) (= 0 (mod c 2))))) # [[2] [1 3]]
452452# =end
453- # @author https://github.com/rakista112
453+ # @author https://github.com/SuperFola
454454(let partition (fun ((ref _L) _f) {
455455 (mut _index 0)
456456 (mut _pass [])
506506 (set _index (+ 1 _index)) })
507507 _c }))
508508
509- # @brief Zip two lists into one, using a filler is one list is shorter: [1 2 3] and [5 6 7 8] will give [[1 5] [2 6] [3 7] [0 8]]
509+ # @brief Zip two lists into one, using a filler if one list is shorter: [1 2 3] and [5 6 7 8] will return [[1 5] [2 6] [3 7] [0 8]]
510510# @param _a the first list to work on
511511# @param _b the second list to work on
512512# @param _filler value to use if there is not enough items in one of the lists
851851# @param _f function to call on each permutation. It can return list:stopIteration to stop iteration early
852852# =begin
853853# (let data [0 1 2])
854- # (list:permutations_with_replacement data 2 (fun (perm) (print perm)))
854+ # (list:permutationsWithReplacement data 2 (fun (perm) (print perm)))
855855# # [0 0]
856856# # [0 1]
857857# # [0 2]
860860# # [2 2]
861861# =end
862862# @author https://github.com/SuperFola
863- (let permutations_with_replacement (fun ((ref _L) _r _f) {
863+ (let permutationsWithReplacement (fun ((ref _L) _r _f) {
864864 (let _len (len _L))
865865 (if (and (!= 0 _len) (> _r 0))
866866 {
Original file line number Diff line number Diff line change 241241 (list:permutations [] 0 (fun (data) (append! perms data)))
242242 (test:eq perms []) })
243243
244- (test:case "permutations_with_replacement " {
244+ (test:case "permutationsWithReplacement " {
245245 (mut perms [])
246- (list:permutations_with_replacement "ABC" 2 (fun (data) (append! perms data)))
246+ (list:permutationsWithReplacement "ABC" 2 (fun (data) (append! perms data)))
247247 (test:eq perms [["A" "A"] ["A" "B"] ["A" "C"] ["B" "B"] ["B" "C"] ["C" "C"]])
248248
249249 (set perms [])
250- (list:permutations_with_replacement "ABC" 0 (fun (data) (append! perms data)))
250+ (list:permutationsWithReplacement "ABC" 0 (fun (data) (append! perms data)))
251251 (test:eq perms [])
252252
253253 (set perms [])
254- (list:permutations_with_replacement "" 2 (fun (data) (append! perms data)))
254+ (list:permutationsWithReplacement "" 2 (fun (data) (append! perms data)))
255255 (test:eq perms []) }) })
You can’t perform that action at this time.
0 commit comments