DEV Community

loading...

Discussion on: Daily Challenge #172 - Find All in an Array

Collapse
citizen428 profile image
Michael Kohl

I made a ReasonML version too:

let findAll = (xs, n) =>
  List.filter_mapi(xs, (i, x) =>
    if (x == n) {
      Some(i);
    } else {
      None;
    }
  );

Since things can get confusing in ReasonML-land, this is Reason Native, not Bucklescript, so it's using Base as standard library.