Created
November 18, 2019 22:19
-
-
Save tonymorris/bbd43a9ca9d9f423b5c413eb49b5f094 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
foldRight' :: | |
(b -> z -> z) | |
-> (a -> b) | |
-> z | |
-> [a] | |
-> z | |
foldRight' _ _ z [] = | |
z | |
foldRight' k f z (x:xs) = | |
k (f x) (foldRight' k f z xs) | |
map' :: | |
(([a] -> [a]) -> [b] -> [b]) -> (c -> a) -> [c] -> [b] | |
map' k f = | |
foldRight' k ((:) . f) [] | |
program' :: | |
(([Int] -> [Int]) -> [a] -> [a]) | |
-> [a] | |
program' k = | |
take 10 (map' k (+1) [1..]) | |
terminates :: | |
[Int] | |
terminates = | |
program' id | |
doesNotTerminate :: | |
[Int] | |
doesNotTerminate = | |
program' ($!) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment