Skip to content

Instantly share code, notes, and snippets.

@willf
Created May 25, 2010 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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