<commit_before># [![Collectable.js](.assets/logo.png)](https://github.com/frptools/collectable)

An all-you-can-eat buffet of high-performance, immutable/persistent data structures.

[![Build Status](https://travis-ci.org/frptools/collectable.svg?branch=master)](https://travis-ci.org/frptools/collectable)
[![NPM version](https://badge.fury.io/js/collectable.svg)](http://badge.fury.io/js/collectable)
[![GitHub version](https://badge.fury.io/gh/frptools%2Fcollectable.svg)](https://badge.fury.io/gh/frptools%2Fcollectable)
[![Gitter](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/FRPTools/Lobby)

## Available Data Structures

- [ **[List](/packages/list#collectablejs-immutable-list)** ] A persistent vector structure based on a modified [RRB Tree](https://infoscience.epfl.ch/record/169879/files/RMTrees.pdf) implementation, with very fast concatenation, insertion and deletion of ranges of values, etc.
- [ **[Map](/packages/map#collectablejs-immutable-map)** ] A Clojure-style hash-array-mapped trie, adapted by [TylorS](https://github.com/TylorS) from [<NAME>'s HAMT](https://github.com/mattbierner/hamt_plus) implementation.  
  *Note: stopgap ES6 Map-backed implementation currently in place, to be replaced shortly.*
- [ **[Set](/packages/set#collectablejs-immutable-set)** ] A persistent set implementation, backed by our own immutable map structure.  
  *Note: stopgap ES6 Set-backed implementation currently in place, to be replaced shortly.*
- [ **[Red Black Tree](/packages/red-black-tree#immutable-red-black-tree)** ] A persistent red/black tree structure, typically intended to be used as a backing structure for other data structures.
- [More to come...](/https://github.com/frptools/collectable/wiki)

Want to help out? See [the guide for contributors](CONTRIBUTING.md).

## Installation

```
# via NPM
npm install --save collectable

# or Yarn
yarn add collectable
```

TypeScript type definitions are included by default.

## Usage

**API Reference:**
[ [General](/docs/index.md#collectablejs-general-api)
| [List](/packages/list/README.md#collectablejs-immutable-list)
| [Map](/packages/map/README.md#collectablejs-immutable-map)
| [Set](/packages/set/README.md#collectablejs-immutable-set)
| [Red Black Tree](/packages/red-black-tree/README.md#immutable-red-black-tree)
| [Others...](/https://github.com/frptools/collectable/wiki) ]

Individual data structures are pulled in automatically as dependencies of the main package. By having your project take a dependency on `collectable` itself, all data structures are made available implicitly as scoped imports, and operations on deeply-nested data structures are available via the main package.

For example, to use an immutable list:

```js
import {fromArray, unwrap} from '@collectable/list';

const list = fromArray(['X', 'Y']);
const array = unwrap(list);
```

Pre-curried versions of functions for a given data structure are available by appending `/curried` to the import path, like so:

```ts
import {fromArray, append} from '@collectable/list/curried';

const two = fromArray(['X', 'Y']); // => [X, Y]
const addZ = append('Z');<commit_msg>remove forward slash in absolute path (#26)<commit_after># [![Collectable.js](.assets/logo.png)](https://github.com/frptools/collectable)

An all-you-can-eat buffet of high-performance, immutable/persistent data structures.

[![Build Status](https://travis-ci.org/frptools/collectable.svg?branch=master)](https://travis-ci.org/frptools/collectable)
[![NPM version](https://badge.fury.io/js/collectable.svg)](http://badge.fury.io/js/collectable)
[![GitHub version](https://badge.fury.io/gh/frptools%2Fcollectable.svg)](https://badge.fury.io/gh/frptools%2Fcollectable)
[![Gitter](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/FRPTools/Lobby)

## Available Data Structures

- [ **[List](/packages/list#collectablejs-immutable-list)** ] A persistent vector structure based on a modified [RRB Tree](https://infoscience.epfl.ch/record/169879/files/RMTrees.pdf) implementation, with very fast concatenation, insertion and deletion of ranges of values, etc.
- [ **[Map](/packages/map#collectablejs-immutable-map)** ] A Clojure-style hash-array-mapped trie, adapted by [TylorS](https://github.com/TylorS) from [<NAME>ner's HAMT](https://github.com/mattbierner/hamt_plus) implementation.  
  *Note: stopgap ES6 Map-backed implementation currently in place, to be replaced shortly.*
- [ **[Set](/packages/set#collectablejs-immutable-set)** ] A persistent set implementation, backed by our own immutable map structure.  
  *Note: stopgap ES6 Set-backed implementation currently in place, to be replaced shortly.*
- [ **[Red Black Tree](/packages/red-black-tree#immutable-red-black-tree)** ] A persistent red/black tree structure, typically intended to be used as a backing structure for other data structures.
- [More to come...](https://github.com/frptools/collectable/wiki)

Want to help out? See [the guide for contributors](CONTRIBUTING.md).

## Installation

```
# via NPM
npm install --save collectable

# or Yarn
yarn add collectable
```

TypeScript type definitions are included by default.

## Usage

**API Reference:**
[ [General](/docs/index.md#collectablejs-general-api)
| [List](/packages/list/README.md#collectablejs-immutable-list)
| [Map](/packages/map/README.md#collectablejs-immutable-map)
| [Set](/packages/set/README.md#collectablejs-immutable-set)
| [Red Black Tree](/packages/red-black-tree/README.md#immutable-red-black-tree)
| [Others...](https://github.com/frptools/collectable/wiki) ]

Individual data structures are pulled in automatically as dependencies of the main package. By having your project take a dependency on `collectable` itself, all data structures are made available implicitly as scoped imports, and operations on deeply-nested data structures are available via the main package.

For example, to use an immutable list:

```js
import {fromArray, unwrap} from '@collectable/list';

const list = fromArray(['X', 'Y']);
const array = unwrap(list);
```

Pre-curried versions of functions for a given data structure are available by appending `/curried` to the import path, like so:

```ts
import {fromArray, append} from '@collectable/list/curried';

const two = fromArray(['X', 'Y']); // => [X, Y]
const addZ = append('Z');
{'fraction_non_alphanumeric': 0.14661594547471865, 'fraction_numerical': 0.003487081946425741, 'mean_word_length': 5.266137040714995, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 26, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3970507', 'n_tokens_mistral': 2036, 'n_tokens_neox': 1966, 'n_words': 515}