Last active
December 15, 2015 04:50
-
-
Save shhyou/5204636 to your computer and use it in GitHub Desktop.
CPS transformed version of match0n1n-1.hs
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
-- The CPS-transformed version of match. | |
-- https://gist.github.com/suhorng/5204442 | |
match' :: String -> Bool | |
match' s = trace s null | |
where trace :: String -> (String -> Bool) -> Bool | |
trace ('0':xs) k = trace xs $ \remainString -> | |
case remainString of | |
'1':xs' -> k xs' | |
_ -> False | |
trace xs k = k xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment