This PR renames `Stream` to `Std.Stream` so that the name becomes available to mathlib after a deprecation cycle.
8 lines
210 B
Text
8 lines
210 B
Text
@[simp] def take [S : Std.Stream ρ τ] (s : ρ) : Nat → List τ × ρ
|
||
| 0 => ([], s)
|
||
| n+1 =>
|
||
match S.next? s with
|
||
| none => ([], s)
|
||
| some (x,rest) =>
|
||
let (L,rest) := take rest n
|
||
(x::L, rest)
|