summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-12-31 10:21:26 -0500
committerAndrew Cady <d@jerkface.net>2020-12-31 10:21:26 -0500
commit521227fde4cb513c65279ed0886675eb2c72581b (patch)
tree82a215259d38301dee37fc9b3c0a0afc0f7a3899
parent3b57f59955968a3c3288ba3e8fb79114b78bc370 (diff)
built shelf #1 w/ this code
-rwxr-xr-xshelf.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/shelf.hs b/shelf.hs
index 8389d63..9544acf 100755
--- a/shelf.hs
+++ b/shelf.hs
@@ -40,8 +40,8 @@ numShelves = length shelves
40numHorizontals = numShelves + 1 40numHorizontals = numShelves + 1
41availableSpace = boardLength - kickerHeight - (toRational numHorizontals) * boardThickness 41availableSpace = boardLength - kickerHeight - (toRational numHorizontals) * boardThickness
42 42
43shelves :: [Rational] 43shelves :: [Inches]
44shelves = map (* availableSpace) [2%9, 2%9, 2%9, 1%6, 1%6] 44shelves = map (* availableSpace) $ map (% 18) [4, 4, 4, 3, 3]
45 45
46positions, positions' :: [Inches] 46positions, positions' :: [Inches]
47positions = map sum $ (tail . inits) $ concatMap (: [boardThickness]) $ kickerHeight : shelves 47positions = map sum $ (tail . inits) $ concatMap (: [boardThickness]) $ kickerHeight : shelves
@@ -50,7 +50,7 @@ positions' = map (boardLength -) positions
50 50
51main :: IO () 51main :: IO ()
52main = do 52main = do
53 void $ return $ assert $ sum shelves == 1 53 return $ assert $ sum shelves == 1
54 mapM_ putStrLn $ formatFeet <$> positions 54 mapM_ putStrLn $ formatFeet <$> positions
55 putStrLn "" 55 putStrLn ""
56 mapM_ putStrLn $ formatFeet <$> positions' 56 mapM_ putStrLn $ formatFeet <$> positions'