Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System.IO
- type PostCodeResult = { PostCode: string; Valid: bool }
- let linesToFile filename (lines: string seq) =
- use writer = File.CreateText(filename)
- for line in lines
- do writer.WriteLine(line)
- let formatLine pcr = pcr.PostCode + "-" + (string pcr.Valid) + "\n"
- let postCodeValidationResults = [ { PostCode = "12345"; Valid = true }; { PostCode = "asdf"; Valid = false }]
- let dataForFile = postCodeValidationResults |> Seq.map formatLine
- dataForFile |> linesToFile "postcodes.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement