# list8

> a js structure for infinite lazy list and some method to control the list Edit

Latest version **0.0.2** (published 2019-07-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install list8
pnpm add list8
yarn add list8
bun add list8
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-07-10 |
| First published | 2017-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | waksana@qq.com |
| Maintainers | waksana |
| Keywords | list, lazy |

## Links

- npm: https://www.npmjs.com/package/list8
- Repository: https://github.com/waksana/infinite-list
- Homepage: https://github.com/waksana/infinite-list#readme
- Issues: https://github.com/waksana/infinite-list/issues
- npm.io page: https://npm.io/package/list8

## Recent versions

- 0.0.2 (latest) — 2019-07-10
- 0.0.1 — 2017-02-10

## README

# list8
a js data structure for infinity lazy list and some method to control the list. 8 indicates infinity

## EXAMPLE

```javascript
var N = List.cons(1, () => N.map(n => n + 1)); //nature number list
var ones = List.cons(1, () => ones);

//combine header and a list into a list
var Z = List.cons(0, N); //Integer list

assert.deepEqual(N.drop(5).take(5), [6, 7, 8, 9, 10]);
assert.deepEqual(N.filter(a => a % 2 == 0).take(5), [2, 4, 6, 8, 10]);
assert.deepEqual(N.map(a => a + 1).take(3), [2, 3, 4]);
assert.deepEqual(N.zipWith(Z, (n, z) => n * z).take(3), [0, 2, 6]);

//get a infinite prime list (inefficient)
var sieve = ls =>
List.cons(ls.head, () => sieve(ls.tail.filter(a => a % ls.head != 0)));
var prime = sieve(N.tail);
assert.deepEqual(prime.take(5), [2, 3, 5, 7, 11]);

//fibonacci
var fibs = List.cons(0, () => List.cons(1, () => fibs.zipWith(fibs.tail, (a, b) => a + b)));

assert.deepEqual(fibs.take(6), [0, 1, 1, 2, 3, 5]);
```

---
_Source: https://npm.io/package/list8 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
