I\'m trying to learn F# by rewriting some C# algorithms I have into idiomatic F#.
One of the first functions I\'m trying to rewrite is a batchesOf where:
This isn't perhaps idiomatic but it works:
let batchesOf n l = let _, _, temp', res' = List.fold (fun (i, n, temp, res) hd -> if i < n then (i + 1, n, hd :: temp, res) else (1, i, [hd], (List.rev temp) :: res)) (0, n, [], []) l (List.rev temp') :: res' |> List.rev