trotter 2.0.0-dev.1 copy "trotter: ^2.0.0-dev.1" to clipboard
trotter: ^2.0.0-dev.1 copied to clipboard

outdated

Class definitions for pseudo-lists that simplify working with structures commonly encountered in combinatorics such as permutations, combinations and subsets.

example/example.dart

import 'dart:math' show Random;
import 'package:trotter/trotter.dart';

void main() {
  final rand = Random(),
      perms = ['Steinhaus', 'Johnson', 'Trotter'].permutations(),
      dissent = [
    'No, no, no!',
    'I disagree.',
    "That's absurd",
    'Preposterous!'
  ],
      exclaim = () => dissent[rand.nextInt(dissent.length)],
      title = (List<String> names) => names.join('-') + ' ordering';

  print(
      'Gentlemen, I propose we call the ordering of permutations the ${title(perms().first)}.');

  for (final perm in perms().skip(1)) {
    print("${exclaim()} It should be the ${title(perm)}!");
  }
  print("\nOkay then... we'll vote on it!");
}
62
likes
0
pub points
86%
popularity

Publisher

unverified uploader

Class definitions for pseudo-lists that simplify working with structures commonly encountered in combinatorics such as permutations, combinations and subsets.

Homepage
View/report issues

License

unknown (LICENSE)

More

Packages that depend on trotter