reasonml-community / belt

MIT License
49 stars 1 forks source link

range API #20

Open bsansouci opened 6 years ago

bsansouci commented 6 years ago

Often times I want to do some task X amount of time to build a data structure. For loops aren't ideal because: 1) they have quirks (inclusive end bound, which is very error prone) 2) they are expressions that return Unit, so you need to use refs

I'd like something like

let myThing = Range.fold_left(10, [], (acc, i) => [i, ...acc]);

for example

cc @schmavery