Skip to content

Commit 2cc9554

Browse files
Adding extra construction functions
1 parent 0ef4147 commit 2cc9554

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/Data/R2Tree/Double.hs

+18
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ module Data.R2Tree.Double
8181
-- * Construct
8282
, empty
8383
, singleton
84+
, doubleton
85+
, tripleton
86+
, quadrupleton
8487

8588
-- ** Bulk-loading
8689
, bulkSTR
@@ -163,3 +166,18 @@ empty = Empty
163166
-- Tree with a single entry.
164167
singleton :: MBR -> a -> R2Tree a
165168
singleton = Leaf1
169+
170+
-- | \(\mathcal{O}(1)\).
171+
-- Tree with two entries.
172+
doubleton :: MBR -> a -> MBR -> a -> R2Tree a
173+
doubleton = Leaf2
174+
175+
-- | \(\mathcal{O}(1)\).
176+
-- Tree with three entries.
177+
tripleton :: MBR -> a -> MBR -> a -> MBR -> a -> R2Tree a
178+
tripleton = Leaf3
179+
180+
-- | \(\mathcal{O}(1)\).
181+
-- Tree with four entries.
182+
quadrupleton :: MBR -> a -> MBR -> a -> MBR -> a -> MBR -> a -> R2Tree a
183+
quadrupleton = Leaf4

src/Data/R2Tree/Float.hs

+18
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ module Data.R2Tree.Float
2121
-- * Construct
2222
, empty
2323
, singleton
24+
, doubleton
25+
, tripleton
26+
, quadrupleton
2427

2528
-- ** Bulk-loading
2629
, bulkSTR
@@ -103,3 +106,18 @@ empty = Empty
103106
-- Tree with a single entry.
104107
singleton :: MBR -> a -> R2Tree a
105108
singleton = Leaf1
109+
110+
-- | \(\mathcal{O}(1)\).
111+
-- Tree with two entries.
112+
doubleton :: MBR -> a -> MBR -> a -> R2Tree a
113+
doubleton = Leaf2
114+
115+
-- | \(\mathcal{O}(1)\).
116+
-- Tree with three entries.
117+
tripleton :: MBR -> a -> MBR -> a -> MBR -> a -> R2Tree a
118+
tripleton = Leaf3
119+
120+
-- | \(\mathcal{O}(1)\).
121+
-- Tree with four entries.
122+
quadrupleton :: MBR -> a -> MBR -> a -> MBR -> a -> MBR -> a -> R2Tree a
123+
quadrupleton = Leaf4

0 commit comments

Comments
 (0)