implemented getNumRungs
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -36,7 +36,7 @@ module Abacus.Internal (Abacus (..)) where
|
||||
data Abacus = Abacus
|
||||
{ abacusNumBeads :: Int
|
||||
-- ^ The number of beads per rung of the abacus
|
||||
, abacusRows :: [Int]
|
||||
, abacusRungs :: [Int]
|
||||
-- ^ The number of beads slid across each rung
|
||||
} deriving (Eq, Show)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user