implemented getNumRungs

This commit is contained in:
2024-08-20 20:52:14 -04:00
parent 9bd9b4a05e
commit 24a1f2f10c
3 changed files with 22 additions and 3 deletions

View File

@@ -24,7 +24,7 @@ License along with this program. If not, see
-}
module Abacus (Abacus, newAbacus, getNumBeads) where
module Abacus (Abacus, newAbacus, getNumBeads, getNumRungs) where
import Abacus.Internal
@@ -40,8 +40,12 @@ newAbacus beads rungs = if beads < 1 || rungs < 1
then Nothing
else Just $ Abacus beads $ replicate rungs 0
-- | Returns the number of beads per rung in an abacus
-- | Returns the number of beads per rung in an "Abacus"
getNumBeads :: Abacus -> Int
getNumBeads = abacusNumBeads
-- | Returns the number of rungs in an "Abacus"
getNumRungs :: Abacus -> Int
getNumRungs = length . abacusRungs
--jl