Created
February 27, 2019 18:27
-
-
Save eschaefer/2427727e8ce899a240ad7acac36c8b21 to your computer and use it in GitHub Desktop.
ReasonML 2D array reduce or fold_left
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let nestedArray = [|[|1, 1|], [|1, 2|], [|1, 3|]|]; | |
let _ = nestedArray |> Array.fold_left(Array.append, [||]) |> Js.log; | |
/* [1,1,1,2,1,3] */ | |
let _ = nestedArray |> Js.Array.reduce(Js.Array.concat, [||]) |> Js.log; | |
/* [1,3,1,2,1,1] */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
REPL example is here.