travisstaloch/combinatorics.zig
A port of Julia's combinatorics library along with miscellaneous related tools.
An incomplete port of Julia's combinatorics library along with miscellaneous related tools.
WARNING This library is very immature, untested and may have bugs. Use at your own risk.
This library provides itertors over set permutations and combinations. It also provides an NChooseK
iterator. Combination
set sizes are limited to 127. Permutations
and nthperm
set sizes are limited to 34. For larger set sizes use nthpermBig
, PermutationsBig
, NChooseKBig
and CombinationsBig
.
$ gyro add --src github travisstaloch/combinatorics.zig
const pkgs = @import("gyro").pkgs;
pkgs.addAllTo(exe/lib/tests);
copy relevent files from src/ into your project or git submodule
the entire project.
To test this project
zig build test
Or with gyro
gyro build test
look at the tests in permutations.zig, combinations.zig and misc.zig. Tests are usually found at the bottom of the files or directly after the thing they're testing.