Skip to content

Instantly share code, notes, and snippets.

@yingtai
Created November 23, 2013 10:15
Show Gist options
  • Save yingtai/7612918 to your computer and use it in GitHub Desktop.
Save yingtai/7612918 to your computer and use it in GitHub Desktop.
import Eval (eval)
results = [eval "(\\x. x) (\\x. x)" == "(\\ 0)",
eval "(\\x. x x) (\\x. \\y. x)" == "(\\ (\\ (\\ 1)))",
eval "(\\p. p (\\t. \\f. t)) ((\\f. \\s. \\b. b f s) (\\x. x) (\\x. \\y. x))" == "(\\ 0)",
eval "(\\x. \\y. \\z. x z (y z)) (\\x. \\y. x) (\\x. \\y. x) (\\x. \\y. x)" == "(\\ (\\ 1))",
eval "(\\m. m (\\x. \\t. \\f. f) (\\t. \\f. t)) ((\\n. \\s. \\z. s (n s z)) (\\s. \\z. s z))" == "(\\ (\\ 0))"]
main = do
let xs = filter (not . snd) $ zip [0..] results :: [(Int, Bool)]
if null xs then putStrLn "OK"
else putStrLn $ "Failed in No." ++ (show $ fst $ head xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment