General FizzBuzz: Difference between revisions

m
Line 1,408:
----------------- FIZZETC (USING RULE SET) ---------------
 
fizzEtc :: [Rule(Int, String)] -> Int -> [String]
fizzEtc rules n = foldr nextLine [] [1 .. n]
where
nextLine x a
Line 1,422:
 
------------------- TEST OF SAMPLE RULES -----------------
testFizzfizzTest :: Int -> [String]
 
testFizzfizzTest = fizzEtc [(3, "Fizz"), (5, "Buzz"), (7, "Baxx")]
testFizz :: Int -> [String]
testFizz = fizzEtc [(3, "Fizz"), (5, "Buzz"), (7, "Baxx")]
 
main :: IO ()
main = mapM_ putStrLn (testFizz$ take 20)</lang> fizzTest
</lang>
{{Out}}
<pre>1
9,659

edits