open System let digits = """ 00000000000001111111110000000000 00000000001111111111111000000000 00000000011111111111111100000000 00000000011111111111111100000000 00000000011111111111111110000000 00000001111111111111111100000000 00000000111110000011111100000000 00000000000000000001111100000000 00000000000000000001111100000000 00000000000000000001111100000000 00000000000000000011111000000000 00000000000000000111111000000000 00000000000000000111111000000000 00000000000000000111111000000000 00000000000000001111110000000000 00000000011111111111111111000000 00000000111111111111111111100000 00000000111111111111111111100000 00000000111111111111111111100000 00000001111111111111111110000000 00000001111111111110000000000000 00000001111111111110000000000000 00000000111111111110000000000000 00000000000011111000000000000000 00000000000011111000000000000000 00000000000011111000000000000000 00000000000111111000000000000000 00000000000111111000000000000000 00000000001111110000000000000000 00000000011111110000000000000000 00000000001111100000000000000000 00000000001111100000000000000000 7 00000000000000000001111100000000 00000000000000000011111100000000 00000000000000001111111100000000 00000000000001111111111100000000 00000000000011111111111110000000 00000000000011111111011111000000 00000000001111111100011111000000 00000000011111111000011111000000 00000000011111100000011111000000 00000000111111000000111110000000 00000001111110000000111110000000 00000011111110010001111111000000 00000111111111111111111111000000 00000111111111111111111111100000 00000111111111111111111111000000 00000011111111111111111111100000 00000001111111111111111111000000 00000000000000000111110000000000 00000000000000000111110000000000 00000000000000000111110000000000 00000000000000000111110000000000 00000000000000001111000000000000 00000000000000001111100000000000 00000000000000001111100000000000 00000000000000011111000000000000 00000000000000001111000000000000 00000000000000011111000000000000 00000000000000011111000000000000 00000000000000011111100000000000 00000000000000001111100000000000 00000000000000001111000000000000 00000000000000000111000000000000 4 """ let labelledCharacter idx = let lines = digits.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries) let floats = lines.[idx * 33..idx * 33 + 31] |> Array.map (fun line -> line.ToCharArray() |> Array.map (string >> float)) |> Array.concat let label = int <| lines.[idx * 33 + 32].Trim() floats, label let labelledLetters digits = let rec loop idx current = try let next = labelledCharacter idx loop (idx + 1) (Array.append current [|next|]) with | :? IndexOutOfRangeException -> current loop 0 [||]