Last active
March 15, 2025 14:36
-
-
Save illusory0x0/fe4d4aa55ecf47d2cae7c8e5561282b2 to your computer and use it in GitHub Desktop.
lazy pattern match in Haskell
This file contains hidden or 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
| import Data.Function (fix) | |
| -- lazy pattern match example | |
| (is_odd, is_even) = | |
| fix | |
| ( \ ~(is_odd, is_even) -> | |
| ( (\n -> if n == 0 then False else is_even (n - 1)) | |
| , (\n -> if n == 0 then True else is_odd (n - 1)) | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment