Skip to content

Instantly share code, notes, and snippets.

@willf
Created May 25, 2010 06:45
Show Gist options
  • Save willf/412857 to your computer and use it in GitHub Desktop.
Save willf/412857 to your computer and use it in GitHub Desktop.
read a sequence of lines in F# #fsharp
open System
open System.IO
let readLines (sr:TextReader) =
Seq.initInfinite (fun _ -> sr.ReadLine())
|> Seq.takeWhile (fun x -> x <> null)
let consoleLines() =
readLines Console.In
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment