@extra-array/from-apply
Version:
Generates array from function application.
48 lines (34 loc) • 1.36 kB
Markdown
Generates array from function application.
[:package:](https://www.npmjs.com/package/@extra-array/from-apply)
[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
[:running:](https://npm.runkit.com/@extra-array/from-apply)
[:vhs:](https://asciinema.org/a/332055)
[:moon:](https://www.npmjs.com/package/@extra-array/from-apply.min)
[:scroll:](https://unpkg.com/@extra-array/from-apply/)
[:newspaper:](https://nodef.github.io/extra-array/)
[:blue_book:](https://github.com/nodef/extra-array/wiki/)
> Alternatives: [from], [from$], [fromRange], [fromApply].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
<br>
```javascript
array.fromApply(fn, v, [n]);
// fn: map function (v, i, x)
// v: start value
// n: number of values (0)
```
```javascript
const array = require("extra-array");
array.fromApply(v => v+2, 2, 4);
// [ 2, 4, 6, 8 ]
array.fromApply(v => v*2, 2, 4);
// [ 2, 4, 8, 16 ]
```
<br>
<br>
## References
- [Data.List.iterate: Haskell](https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-List.html#v:iterate)
[from]: https://github.com/nodef/extra-array/wiki/from
[fromRange]: https://github.com/nodef/extra-array/wiki/fromRange
[fromApply]: https://github.com/nodef/extra-array/wiki/fromApply
[from$]: https://github.com/nodef/extra-array/wiki/from$