Skip to content

jieyouxu/duple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Duple

Minimal tuple library for Dart.

Usage

Simple usage examples as follows. See accompanying tests for more specific examples.

Import duple.

import 'package:duple/duple.dart';

Empty Tuple

All EmptyTuples are identical.

main() {
  var emptyTuple = EmptyTuple();
  assert(emptyTuple == EmptyTuple());
}

One-Tuple

main() {
  var oneTupleWithString = Tuple1<String>('hello world!');
  var oneTupleWithInt = Tuple1<int>(1);
  print("One tuple contains ${oneTupleWithInt.item0}");
}

Two-Tuple

main() {
  var twoTupleWithSameTypes = Tuple2<int, int>(1, 2);
  var twoTupleWithDifferentTypes = Tuple2<int, String>(1, 'X');
  print("Two tuple contains ${twoTupleWithSameTypes.item0}, "
  " and ${twoTupleWithSameTypes.item1}");
}

N-Tuples

Currently tuples from 0-tuples to 7-tuples are supported.

Releases

No releases published

Packages

No packages published

Languages