persistent 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 21

Efficient Persistent Data Structures

Mostly efficient persistent maps and sets for now. Also option types.

"Persistent" means immutable here, not "saved on disk".

import 'package:persistent/persistent.dart';

main() {
  final emptyMap = new PersistentMap<String,int>();
  final m1 = emptyMap.insert('a', 1).insert('b', 2);
  final m2 = new PersistentMap<String,int>.fromMap({'a': 3, 'c': 4});

  print(m1);  // {a: 1, b: 2}
  print(m2);  // {c: 4, a: 3}
  print(m1.lookup('a'));  // Option.some(1)
  print(m1.lookup('c'));  // Option.none()

  final m3 = m1.delete('a');
  print(m1);  // {a: 1, b: 2}
  print(m3);  // {b: 2}

  final m4 = m1.union(m2, (n,m) => n + m);
  print(m4);  // {c: 4, a: 4, b: 2}

  final m5 = m1.mapValues((n) => n + 1);
  print(m5);  // {a: 2, b: 3}

  final m6 = m1.adjust('a', (n) => n + 1);
  print(m6);  // {a: 2, b: 2}
}

Try it!

git clone https://github.com/polux/persistent.git
cd persistent
pub install
dart example/map_example.dart
dart example/set_example.dart
dart test/map_bench.dart

More

See ImplementationDetails and the generated API documentation for more information.

Persistent Changelog

1.0.0

  • Pass dart 2 analyzer

0.9.0

  • Make strong mode compliant

0.8.3

  • Remove call to deprecated function in args parsing
  • Use new enumerators' apply in tests
  • Bump dependencies' upper bounds

0.8.2

  • Mode run_all_tests.sh to tests/run.sh to adhere to pub.drone.io's conventions.

0.8.1

  • Added CHANGELOG.md
  • Moved benchmarks to the standard benchmark directory

example/main.dart

// Copyright (c) 2018, Google Inc. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

// Author: Paul Brauner (polux@google.com)

import 'map_example.dart' as map_example;
import 'set_example.dart' as set_example;

main() {
  map_example.main();
  set_example.main();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  persistent: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:persistent/persistent.dart';
  
Version Uploaded Documentation Archive
1.0.0 Mar 15, 2018 Go to the documentation of persistent 1.0.0 Download persistent 1.0.0 archive
0.9.0 Mar 2, 2018 Go to the documentation of persistent 0.9.0 Download persistent 0.9.0 archive
0.8.3 Dec 20, 2014 Go to the documentation of persistent 0.8.3 Download persistent 0.8.3 archive
0.8.2 Sep 16, 2014 Go to the documentation of persistent 0.8.2 Download persistent 0.8.2 archive
0.8.1 Jun 1, 2014 Go to the documentation of persistent 0.8.1 Download persistent 0.8.1 archive
0.8.0 Nov 8, 2013 Go to the documentation of persistent 0.8.0 Download persistent 0.8.0 archive
0.7.7 Nov 5, 2013 Go to the documentation of persistent 0.7.7 Download persistent 0.7.7 archive
0.7.6 Oct 24, 2013 Go to the documentation of persistent 0.7.6 Download persistent 0.7.6 archive
0.7.5 Oct 2, 2013 Go to the documentation of persistent 0.7.5 Download persistent 0.7.5 archive
0.7.4 Sep 17, 2013 Go to the documentation of persistent 0.7.4 Download persistent 0.7.4 archive

All 28 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
41
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
21
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=0.8.10+6 <2.0.0