import Data.List -- Converts the data from the Royal Canadian Air Force's "5BX" exercise program -- into a list of daily exercise instructions. -- From "The Hacker's Diet", http://www.fourmilab.ch/hackdiet/www/subsection1_2_5_0_3.html ladder = [ (1, 2, 3, 4, 2, 1, 30), (2, 3, 4, 5, 3, 1, 65), (3, 4, 6, 6, 3, 2, 20), (4, 6, 7, 8, 4, 2, 50), (5, 7, 9, 9, 5, 3, 0), (6, 8, 10, 10, 6, 3, 30), (7, 10, 11, 12, 7, 3, 55), (8, 12, 13, 14, 8, 4, 5), (9, 14, 15, 16, 9, 4, 25), (10, 16, 16, 18, 11, 4, 50), (11, 18, 18, 20, 12, 4, 70), (12, 20, 20, 22, 13, 5, 15), (13, 23, 21, 25, 15, 5, 30), (14, 25, 23, 27, 16, 5, 50), (15, 28, 25, 30, 18, 5, 65), (16, 14, 10, 12, 9, 4, 40), (17, 15, 11, 14, 10, 4, 55), (18, 16, 12, 16, 11, 5, 0), (19, 18, 13, 17, 12, 5, 15), (20, 19, 14, 19, 13, 5, 30), (21, 21, 15, 21, 14, 5, 45), (22, 22, 16, 23, 15, 5, 60), (23, 24, 17, 25, 16, 5, 70), (24, 25, 18, 27, 17, 6, 10), (25, 27, 20, 29, 18, 6, 20), (26, 29, 21, 31, 19, 6, 30), (27, 31, 23, 33, 20, 6, 40), (28, 33, 24, 36, 21, 6, 50), (29, 34, 26, 38, 22, 6, 60), (30, 36, 28, 40, 23, 6, 65), (31, 38, 29, 43, 24, 7, 0), (32, 40, 31, 45, 25, 7, 5), (33, 43, 33, 48, 26, 7, 10), (34, 45, 35, 51, 27, 7, 15), (35, 47, 37, 54, 28, 7, 15), (36, 49, 39, 56, 29, 7, 20), (37, 51, 41, 59, 30, 7, 20), (38, 54, 43, 62, 31, 7, 20), (39, 56, 46, 65, 32, 7, 25), (40, 59, 48, 68, 33, 7, 30), (41, 61, 50, 72, 34, 7, 30), (42, 64, 53, 75, 35, 7, 30), (43, 66, 55, 78, 36, 7, 35), (44, 69, 58, 81, 37, 7, 35), (45, 72, 61, 85, 38, 7, 35), (46, 74, 64, 88, 39, 7, 50), (47, 77, 66, 92, 40, 7, 50), (48, 80, 69, 96, 41, 7, 50)] -- Create a list of formatted strings type Rung = (Integer, Integer, Integer, Integer, Integer, Integer, Integer) type Ladder = [Rung] formatLadder :: Ladder -> [String] formatLadder = map printRung where printRung (rung, bend, sitUp, legLift, pushUp, runJumpSets, extraSteps) = show bend ++ " bends, " ++ show sitUp ++ " sit-ups, " ++ show legLift ++ " leg lifts, " ++ show pushUp ++ " push-ups, " ++ show runJumpSets ++ " run/jump sets, " ++ show extraSteps ++ " extra steps" -- Repeat each element 7 times - once for each day of the week dailyInstructions = concat (map (replicate 7) (formatLadder ladder)) -- Save to a file main :: IO () main = do writeFile "c:/stuff/ladder.txt" (unlines dailyInstructions)