diff options
author | Andrew Cady <d@jerkface.net> | 2020-12-31 10:21:26 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2020-12-31 10:21:26 -0500 |
commit | 521227fde4cb513c65279ed0886675eb2c72581b (patch) | |
tree | 82a215259d38301dee37fc9b3c0a0afc0f7a3899 | |
parent | 3b57f59955968a3c3288ba3e8fb79114b78bc370 (diff) |
built shelf #1 w/ this code
-rwxr-xr-x | shelf.hs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -40,8 +40,8 @@ numShelves = length shelves | |||
40 | numHorizontals = numShelves + 1 | 40 | numHorizontals = numShelves + 1 |
41 | availableSpace = boardLength - kickerHeight - (toRational numHorizontals) * boardThickness | 41 | availableSpace = boardLength - kickerHeight - (toRational numHorizontals) * boardThickness |
42 | 42 | ||
43 | shelves :: [Rational] | 43 | shelves :: [Inches] |
44 | shelves = map (* availableSpace) [2%9, 2%9, 2%9, 1%6, 1%6] | 44 | shelves = map (* availableSpace) $ map (% 18) [4, 4, 4, 3, 3] |
45 | 45 | ||
46 | positions, positions' :: [Inches] | 46 | positions, positions' :: [Inches] |
47 | positions = map sum $ (tail . inits) $ concatMap (: [boardThickness]) $ kickerHeight : shelves | 47 | positions = map sum $ (tail . inits) $ concatMap (: [boardThickness]) $ kickerHeight : shelves |
@@ -50,7 +50,7 @@ positions' = map (boardLength -) positions | |||
50 | 50 | ||
51 | main :: IO () | 51 | main :: IO () |
52 | main = do | 52 | main = 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' |