persistent 1.0.0

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

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

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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...

Analysis

We analyzed this package on Jul 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

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

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:persistent/persistent.dart.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Run dartfmt to format lib/src/map_impl.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=0.8.10+6 <2.0.0
Dev dependencies
args >=0.9.0 <0.13.0
enumerators >=0.6.0 <0.7.0
http >=0.9.0 <0.12.0
propcheck >=0.6.0 <0.7.0
unittest >=0.9.0 <0.12.0