chitose 2.0.0 copy "chitose: ^2.0.0" to clipboard
chitose: ^2.0.0 copied to clipboard

Chitose is a package that makes it easy to handle Dart Lists, which are implemented inspired by Programming Haskell.

example/main.dart

import 'package:chitose/chitose.dart';

void main() {

  List<int> hoge = [1, 2, 3];

  // You can get the sublist of a list.
  // [[], [3], [2], [2, 3], [1], [1, 3], [1, 2], [1, 2, 3]]
  print(hoge.subs());

  // You can get all the ways that inserted a new element in a list.
  // [[], [3], [2], [2, 3], [1], [1, 3], [1, 2], [1, 2, 3]]
  print(hoge.interleave(4));

  // You can get the permutations of a list.
  // [[1, 2, 3], [2, 1, 3], [2, 3, 1], [1, 3, 2], [3, 1, 2], [3, 2, 1]] 
  print(hoge.perms());

  // You can get the Cartesian product of a list.
  // [[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 1], [1, 2, 2], [1, 2, 3], [1, 3, 1], [1, 3, 2], [1, 3, 3], [2, 1, 1], [2, 1, 2], [2, 1, 3], [2, 2, 1], [2, 2, 2], [2, 2, 3], [2, 3, 1], [2, 3, 2], [2, 3, 3], [3, 1, 1], [3, 1, 2], [3, 1, 3], [3, 2, 1], [3, 2, 2], [3, 2, 3], [3, 3, 1], [3, 3, 2], [3, 3, 3]]
  print(hoge.product(3));
}
2
likes
130
pub points
32%
popularity

Publisher

unverified uploader

Chitose is a package that makes it easy to handle Dart Lists, which are implemented inspired by Programming Haskell.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

collection

More

Packages that depend on chitose