Created
May 24, 2016 22:46
-
-
Save mdunsmuir/a59ca24d8a67f08203cc99d99e899763 to your computer and use it in GitHub Desktop.
This file contains 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 | |
import Control.Monad (when) | |
import System.Environment (getArgs) | |
import Data.List (intersperse) | |
fibo :: [Int] | |
fibo = 0 : 1 : zipWith (+) fibo (tail fibo) | |
hotDogsOnDay :: Int -> Int | |
hotDogsOnDay = (fibo !!) | |
seeTheHotDogsOnDay :: Int -> String | |
seeTheHotDogsOnDay = intersperse ' ' . flip replicate '\127789' . hotDogsOnDay | |
main :: IO () | |
main = do | |
args <- getArgs | |
when (length args /= 1) $ error "must give how many hot dogs only" | |
let day = read (head args) :: Int | |
putStrLn $ seeTheHotDogsOnDay day |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment