Skip to content

Commit b41c25e

Browse files
committed
chore: add comments
1 parent 3e439f7 commit b41c25e

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

src/Std/Data/DTreeMap/Iterator.lean

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,53 @@ module
77

88
prelude
99
public import Std.Data.DTreeMap.Raw.Iterator
10+
11+
/-!
12+
# Iterators on `DTreeMap`
13+
-/
14+
1015
namespace Std.DTreeMap
1116
open Std.Iterators
1217

18+
/--
19+
Returns a finite iterator over the entries of a dependent tree map.
20+
The iterator yields the elements of the map in order and then terminates.
21+
22+
**Termination properties:**
23+
24+
* `Finite` instance: always
25+
* `Productive` instance: always
26+
-/
1327
@[inline]
1428
public def iter {α : Type u} {β : α → Type v} [Ord α] (m : DTreeMap α β) :=
1529
Raw.iter ⟨m.inner⟩
1630

31+
/--
32+
Returns a finite iterator over the keys of a dependent tree map.
33+
The iterator yields the keys in order and then terminates.
34+
35+
The key and value types must live in the same universe.
36+
37+
**Termination properties:**
38+
39+
* `Finite` instance: always
40+
* `Productive` instance: always
41+
-/
1742
@[inline]
1843
public def keysIter {α : Type u} {β : α → Type u} [Ord α] (m : Raw α β) :=
1944
Raw.keysIter ⟨m.inner⟩
2045

46+
/--
47+
Returns a finite iterator over the values of a tree map.
48+
The iterator yields the values in order and then terminates.
49+
50+
The key and value types must live in the same universe.
51+
52+
**Termination properties:**
53+
54+
* `Finite` instance: always
55+
* `Productive` instance: always
56+
-/
2157
@[inline]
2258
public def valuesIter {α : Type u} {β : Type u} [Ord α](m : Raw α (fun _ => β)) :=
2359
Raw.valuesIter ⟨m.inner⟩

src/Std/Data/DTreeMap/Raw/Iterator.lean

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,53 @@ module
88
prelude
99
public import Std.Data.DTreeMap.Internal.Zipper
1010
public import Std.Data.DTreeMap
11+
12+
/-!
13+
# Iterators on `DTreeMap.Raw`
14+
-/
15+
1116
namespace Std.DTreeMap.Raw
1217
open Std.Iterators
1318

19+
/--
20+
Returns a finite iterator over the entries of a dependent tree map.
21+
The iterator yields the elements of the map in order and then terminates.
22+
23+
**Termination properties:**
24+
25+
* `Finite` instance: always
26+
* `Productive` instance: always
27+
-/
1428
@[inline]
1529
public def iter {α : Type u} {β : α → Type v} [Ord α] (m : Raw α β) :=
1630
(Internal.Zipper.iterOfTree m.inner : Iter ((a : α) × β a))
1731

32+
/--
33+
Returns a finite iterator over the keys of a dependent tree map.
34+
The iterator yields the keys in order and then terminates.
35+
36+
The key and value types must live in the same universe.
37+
38+
**Termination properties:**
39+
40+
* `Finite` instance: always
41+
* `Productive` instance: always
42+
-/
1843
@[inline]
1944
public def keysIter {α : Type u} {β : α → Type u} [Ord α] (m : Raw α β) :=
2045
(m.iter.map fun e => e.1 : Iter α)
2146

47+
/--
48+
Returns a finite iterator over the values of a tree map.
49+
The iterator yields the values in order and then terminates.
50+
51+
The key and value types must live in the same universe.
52+
53+
**Termination properties:**
54+
55+
* `Finite` instance: always
56+
* `Productive` instance: always
57+
-/
2258
@[inline]
2359
public def valuesIter {α : Type u} {β : Type u} [Ord α](m : Raw α (fun _ => β)) :=
2460
(m.iter.map fun e => e.2 : Iter β)

src/Std/Data/DTreeMap/Raw/Slice.lean

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ public import Std.Data.DTreeMap.Internal.Ordered
1010
public import Std.Data.DTreeMap.Internal.Zipper
1111
public import Std.Data.DTreeMap.Raw.Basic
1212

13+
/-!
14+
This module provides slice notation for `TreeMap` slices and implements an iterator
15+
for those slices.
16+
-/
17+
1318
namespace Std.DTreeMap.Raw
1419
open Std.Iterators
1520

@@ -19,7 +24,8 @@ public instance {α : Type u} {β : α → Type v}
1924
mkSlice carrier range := ⟨carrier.inner, range⟩
2025

2126
@[simp] public theorem toList_rii {α : Type u} {β : α → Type v}
22-
(cmp : α → α → Ordering := by exact compare) {t : Raw α β cmp} : t[*...*].toList = t.toList := by
27+
(cmp : α → α → Ordering := by exact compare) {t : Raw α β cmp} :
28+
t[*...*].toList = t.toList := by
2329
apply Internal.toList_rii
2430

2531
public instance {α : Type u} {β : α → Type v} (cmp : α → α → Ordering := by exact compare) :

src/Std/Data/DTreeMap/Slice.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ module
77

88
prelude
99
public import Std.Data.DTreeMap.Raw.Slice
10+
11+
/-!
12+
This module provides slice notation for `TreeMap` slices and implements an iterator
13+
for those slices.
14+
-/
15+
1016
namespace Std.DTreeMap
1117
open Std.Iterators
1218

0 commit comments

Comments
 (0)