I am still new to functional programming, so if I cannot figure out how to do something, I will return to the procedural style. I found a way around to convert to a list, but I still would like to know how to do this.
Here is my attempt to convert a two-dimensional array to a list.
let board = Array2.init 10 20 (fun ij -> pull(i, j)) let mutable pieces = [] board |> Array2.mapi (fun ija -> transform(i, j, a)) |> Array2.iter (fun a -> (pieces <- a :: pieces))
source share