Builds array from a seed value (dual to foldr).
This is part of package extra-array.
This is browserified, minified version of @extra-array/unfoldr.
It is exported as global variable array_unfoldr.
CDN: unpkg, jsDelivr.
array.unfoldr(x, fn, v);
// fn: unreduce fn (v, i, x)
// v: initial value of accumulator
// --> built array
const array = require('extra-array');
array.unfoldr(v => v===0? undefined : [v, v-1], 10);
// [ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ]