Flattening an Array in ReasonML
April 10, 2020
I needed to flatten an array of arrays the other day, and couldn't find any great examples upon a quick search. Here's how to flatten an array in Reason!
let flattenArray = (arr: array(array('a))): array('a) => Array.(concat(to_list(arr)));
Here is the OCaml equivalent:
let flattenArray arr = Array.(concat (to_list arr))