I've got an array of strings, call it a
, where each individual string represents a number. I also have a function f : int -> int -> int
, which I want to use to "reduce a
to a single number". I would like to write:
a |> Array.reduce (fun x y -> f (int32 x) (int32 y))
but this does not work, because the type of "reduce" forbids me from returning integers from f
(since a
is an array of strings)
Is there a functional way to make this work without having to return a string from
f
or casting the string array to an int array beforehand?