Macro malachite_base::exhaustive_tuples
source ยท macro_rules! exhaustive_tuples { ( ($($vis:tt)*), $exhaustive_struct: ident, $exhaustive_fn: ident, $exhaustive_fn_custom_output: ident, $([$i: tt, $t: ident, $it: ident, $xs: ident, $xs_done: ident, $out_x: ident]),* ) => { ... }; }
Expand description
Defines exhaustive tuple generators.
Malachite provides exhaustive_pairs
and exhaustive_pairs_custom_output
, but you can also
define exhaustive_triples
, exhaustive_quadruples
, and so on, and
exhaustive_triples_custom_output
, exhaustive_quadruples_custom_output
, and so on, in your
program using the code below. The documentation for exhaustive_pairs
and
exhaustive_pairs_custom_output
describes these other functions as well.
See usage examples here and here.
use malachite_base::exhaustive_tuples;
use malachite_base::iterators::bit_distributor::{BitDistributor, BitDistributorOutputType};
use malachite_base::iterators::iterator_cache::IteratorCache;
use malachite_base::num::conversion::traits::{ExactFrom, WrappingFrom};
use malachite_base::num::logic::traits::SignificantBits;
use std::cmp::max;
exhaustive_tuples!(
(pub(crate)),
ExhaustiveTriples,
exhaustive_triples,
exhaustive_triples_custom_output,
[0, X, I, xs, xs_done, output_type_x],
[1, Y, J, ys, ys_done, output_type_y],
[2, Z, K, zs, zs_done, output_type_z]
);
exhaustive_tuples!(
(pub(crate)),
ExhaustiveQuadruples,
exhaustive_quadruples,
exhaustive_quadruples_custom_output,
[0, X, I, xs, xs_done, output_type_x],
[1, Y, J, ys, ys_done, output_type_y],
[2, Z, K, zs, zs_done, output_type_z],
[3, W, L, ws, ws_done, output_type_w]
);
exhaustive_tuples!(
(pub(crate)),
ExhaustiveQuintuples,
exhaustive_quintuples,
exhaustive_quintuples_custom_output,
[0, X, I, xs, xs_done, output_type_x],
[1, Y, J, ys, ys_done, output_type_y],
[2, Z, K, zs, zs_done, output_type_z],
[3, W, L, ws, ws_done, output_type_w],
[4, V, M, vs, vs_done, output_type_v]
);
exhaustive_tuples!(
(pub(crate)),
ExhaustiveSextuples,
exhaustive_sextuples,
exhaustive_sextuples_custom_output,
[0, X, I, xs, xs_done, output_type_x],
[1, Y, J, ys, ys_done, output_type_y],
[2, Z, K, zs, zs_done, output_type_z],
[3, W, L, ws, ws_done, output_type_w],
[4, V, M, vs, vs_done, output_type_v],
[5, U, N, us, us_done, output_type_u]
);
exhaustive_tuples!(
(pub(crate)),
ExhaustiveSeptuples,
exhaustive_septuples,
exhaustive_septuples_custom_output,
[0, X, I, xs, xs_done, output_type_x],
[1, Y, J, ys, ys_done, output_type_y],
[2, Z, K, zs, zs_done, output_type_z],
[3, W, L, ws, ws_done, output_type_w],
[4, V, M, vs, vs_done, output_type_v],
[5, U, N, us, us_done, output_type_u],
[6, T, O, ts, ts_done, output_type_t]
);
exhaustive_tuples!(
(pub(crate)),
ExhaustiveOctuples,
exhaustive_octuples,
exhaustive_octuples_custom_output,
[0, X, I, xs, xs_done, output_type_x],
[1, Y, J, ys, ys_done, output_type_y],
[2, Z, K, zs, zs_done, output_type_z],
[3, W, L, ws, ws_done, output_type_w],
[4, V, M, vs, vs_done, output_type_v],
[5, U, N, us, us_done, output_type_u],
[6, T, O, ts, ts_done, output_type_t],
[7, S, P, ss, ss_done, output_type_s]
);