Advertisement
Guest User

Untitled

a guest
Mar 8th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.51 KB | None | 0 0
  1. open System.IO
  2.  
  3. type PostCodeResult = { PostCode: string; Valid: bool }
  4. let linesToFile filename (lines: string seq) =
  5.     use writer = File.CreateText(filename)
  6.     for line in lines
  7.         do writer.WriteLine(line)
  8.    
  9. let formatLine pcr = pcr.PostCode + "-" + (string pcr.Valid) + "\n"
  10.  
  11. let postCodeValidationResults = [ { PostCode = "12345"; Valid = true }; { PostCode = "asdf"; Valid = false }]
  12.  
  13. let dataForFile = postCodeValidationResults |> Seq.map formatLine
  14. dataForFile |> linesToFile "postcodes.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement