implemented newAbacus

This commit is contained in:
2024-08-20 20:09:03 -04:00
parent 4fd9f76c16
commit f43eb607ff
4 changed files with 57 additions and 5 deletions

View File

@@ -28,13 +28,16 @@ module Abacus (Abacus, newAbacus) where
import Abacus.Internal
-- | Constructs the initial state of a new "Abacus"
-- | Constructs the initial state of a new "Abacus"; will return
-- "Nothing" if the input paramebers are invalid.
newAbacus
:: Int
-- ^ The number of beads on each rung
-- ^ The number of beads on each rung (must be at least one)
-> Int
-- ^ The number of rungs
-- ^ The number of rungs (must be at least one)
-> Maybe Abacus
newAbacus = undefined
newAbacus beads rungs = if beads < 1 || rungs < 1
then Nothing
else Just $ Abacus beads $ replicate rungs 0
--jl