How could I write a function that takes a value and produce a list of values?
Ex: value = 2
, function would increment by 1 until a condition is reached (or infinite and I would just take/drop from it), and expected result should look like: [3,4,5,6,7,8...]
right now I'm doing this ugly thing:
let min = ...;
const max = ....;
const acc = [min];
while (min.plus(1). < max) {
min = min.plus(1);
acc.push(min);
}
bonus question .... how could I represent this in type notation? Would it be: (a -> [a]) -> a -> [a]?
Thanks!