Last active
August 29, 2015 13:56
-
-
Save Rembane/8814965 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
-- This one works, but is terribly slow. | |
-- Make it faster!!! | |
step (my, mx) (y, x) = if my == y && mx == x | |
then 1 | |
else stepY + stepX | |
where | |
stepY | y < my = step (my, mx) (y+1, x) | |
| otherwise = 0 | |
stepX | x < mx = step (my, mx) (y, x+1) | |
| otherwise = 0 | |
main = do | |
putStrLn $ show $ zip [1..] $ map (\a -> step (a, a) (0, 0)) [1,2,3,4,5,6,7,8,9,10,11,12] | |
-- putStrLn $ show $ map (\a -> 2**a) [3,4,5,6,7,8,9,10] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment