Open
Description
I was practicing a demo and thought of a simple feature that I think could be discussed.
Basically, as I'm giving a demo of F#, I want to show the intermediate states of the data, a line at a time. It would be useful, if the code looks like this:
Seq.initInfinite (fun n -> n * 2)
|> Seq.map (fun n -> n * n)
|> Seq.filter(fun n -> n % 3 = 0)
|> Seq.take 5
|> Seq.map Some
|> Seq.chunkBySize 5
That this feature would, send current line, if it starts with pipe, prefix with "it" and move to the next line, so I can see all the steps one by one with out having to select two lines, then three, then four, ect.
Example results:
Seq.initInfinite (fun n -> n * 2)
- ;;
val it : seq<int> = seq [0; 2; 4; 6; ...]
> it |> Seq.map (fun n -> n * n)
- ;;
val it : seq<int> = seq [0; 4; 16; 36; ...]
> it |> Seq.filter(fun n -> n % 3 = 0)
- ;;
val it : seq<int> = seq [0; 36; 144; 324; ...]
> it |> Seq.take 5
- ;;
val it : seq<int> = seq [0; 36; 144; 324; ...]
> it |> Seq.map Some
- ;;
val it : seq<int option> = seq [Some 0; Some 36; Some 144; Some 324; ...]
> it |> Seq.chunkBySize 5
- ;;
val it : seq<int option []> =
seq [[|Some 0; Some 36; Some 144; Some 324; Some 576|]]