Created
May 31, 2019 04:52
-
-
Save Xetera/8e6bc502d6760db7dd0deaf5b7120c45 to your computer and use it in GitHub Desktop.
A simple function for generating an infinite list of alternating patterns
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
makePattern :: [(a -> a)] -> a -> [a] | |
makePattern funcs seed = scanl (\a f -> f a) seed (cycle funcs) | |
-- makePattern [(*3), (+1)] 1 | |
-- [1,3,4,12,13,39] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment