7 people like it.
Like the snippet!
Abstract Console.ReadLine as an infinite sequence
Abstracts console input as an infinite sequence of lines of text
1:
2:
3:
4:
5:
6:
7:
8:
|
open System;
let getLine = fun _ -> Console.ReadLine()
let lines = Seq.initInfinite getLine
let echo line = printfn "You said %s" line
Seq.iter echo lines
|
namespace System
val getLine : 'a -> string
Full name: Script.getLine
type Console =
static member BackgroundColor : ConsoleColor with get, set
static member Beep : unit -> unit + 1 overload
static member BufferHeight : int with get, set
static member BufferWidth : int with get, set
static member CapsLock : bool
static member Clear : unit -> unit
static member CursorLeft : int with get, set
static member CursorSize : int with get, set
static member CursorTop : int with get, set
static member CursorVisible : bool with get, set
...
Full name: System.Console
Console.ReadLine() : string
val lines : seq<string>
Full name: Script.lines
module Seq
from Microsoft.FSharp.Collections
val initInfinite : initializer:(int -> 'T) -> seq<'T>
Full name: Microsoft.FSharp.Collections.Seq.initInfinite
val echo : line:string -> unit
Full name: Script.echo
val line : string
val printfn : format:Printf.TextWriterFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val iter : action:('T -> unit) -> source:seq<'T> -> unit
Full name: Microsoft.FSharp.Collections.Seq.iter
More information