Created
October 2, 2021 17:47
-
-
Save pedrofurla/ffc61559d7a4fba74d4c42c6da0c3832 to your computer and use it in GitHub Desktop.
Stackoverflow https://stackoverflow.com/questions/69418700/why-doesnt-this-fixed-point-computation-stop
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
λ> :{ | |
> second (x:y:xs) = y : second xs -- returns every second element of a list | |
> second _ = [] | |
> | |
> xs = [1,2,3,4] ++ second xs | |
> :} | |
λ> second [1,2,3,4] | |
[2,4] | |
λ> second $ second [1,2,3,4] | |
[4] | |
λ> second $ second $ second [1,2,3,4] | |
[] | |
λ> second $ second $ second $ second [1,2,3,4] | |
[] | |
-- we can repeat this ad nauseam |
Author
pedrofurla
commented
Oct 2, 2021
It just occurred to me. The ideal example is xs = [] ++ second xs
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment