https://github.com/jieyouxu/duple
Minimal tuple library for Dart.
https://github.com/jieyouxu/duple
dart dart-library dart2 tuple
Last synced: about 1 year ago
JSON representation
Minimal tuple library for Dart.
- Host: GitHub
- URL: https://github.com/jieyouxu/duple
- Owner: jieyouxu
- License: bsd-3-clause
- Created: 2018-12-24T03:17:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-24T14:41:35.000Z (over 7 years ago)
- Last Synced: 2024-10-27T22:17:52.951Z (over 1 year ago)
- Topics: dart, dart-library, dart2, tuple
- Language: Dart
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Duple
Minimal tuple library for Dart.
## Usage
Simple usage examples as follows. See accompanying tests for more specific examples.
### Import `duple`.
```dart
import 'package:duple/duple.dart';
```
### Empty Tuple
All `EmptyTuple`s are identical.
```dart
main() {
var emptyTuple = EmptyTuple();
assert(emptyTuple == EmptyTuple());
}
```
### One-Tuple
```dart
main() {
var oneTupleWithString = Tuple1('hello world!');
var oneTupleWithInt = Tuple1(1);
print("One tuple contains ${oneTupleWithInt.item0}");
}
```
### Two-Tuple
```dart
main() {
var twoTupleWithSameTypes = Tuple2(1, 2);
var twoTupleWithDifferentTypes = Tuple2(1, 'X');
print("Two tuple contains ${twoTupleWithSameTypes.item0}, "
" and ${twoTupleWithSameTypes.item1}");
}
```
### N-Tuples
Currently tuples from 0-tuples to 7-tuples are supported.