Skip to content

Commit

Permalink
Adding extra construction functions
Browse files Browse the repository at this point in the history
  • Loading branch information
BurningWitness committed Sep 4, 2024
1 parent 0ef4147 commit 2cc9554
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Data/R2Tree/Double.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ module Data.R2Tree.Double
-- * Construct
, empty
, singleton
, doubleton
, tripleton
, quadrupleton

-- ** Bulk-loading
, bulkSTR
Expand Down Expand Up @@ -163,3 +166,18 @@ empty = Empty
-- Tree with a single entry.
singleton :: MBR -> a -> R2Tree a
singleton = Leaf1

-- | \(\mathcal{O}(1)\).
-- Tree with two entries.
doubleton :: MBR -> a -> MBR -> a -> R2Tree a
doubleton = Leaf2

-- | \(\mathcal{O}(1)\).
-- Tree with three entries.
tripleton :: MBR -> a -> MBR -> a -> MBR -> a -> R2Tree a
tripleton = Leaf3

-- | \(\mathcal{O}(1)\).
-- Tree with four entries.
quadrupleton :: MBR -> a -> MBR -> a -> MBR -> a -> MBR -> a -> R2Tree a
quadrupleton = Leaf4
18 changes: 18 additions & 0 deletions src/Data/R2Tree/Float.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module Data.R2Tree.Float
-- * Construct
, empty
, singleton
, doubleton
, tripleton
, quadrupleton

-- ** Bulk-loading
, bulkSTR
Expand Down Expand Up @@ -103,3 +106,18 @@ empty = Empty
-- Tree with a single entry.
singleton :: MBR -> a -> R2Tree a
singleton = Leaf1

-- | \(\mathcal{O}(1)\).
-- Tree with two entries.
doubleton :: MBR -> a -> MBR -> a -> R2Tree a
doubleton = Leaf2

-- | \(\mathcal{O}(1)\).
-- Tree with three entries.
tripleton :: MBR -> a -> MBR -> a -> MBR -> a -> R2Tree a
tripleton = Leaf3

-- | \(\mathcal{O}(1)\).
-- Tree with four entries.
quadrupleton :: MBR -> a -> MBR -> a -> MBR -> a -> MBR -> a -> R2Tree a
quadrupleton = Leaf4

0 comments on commit 2cc9554

Please # to comment.