Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created September 12, 2013 15:28
Show Gist options
  • Save qoelet/6539436 to your computer and use it in GitHub Desktop.
Save qoelet/6539436 to your computer and use it in GitHub Desktop.
-- determine if function f is even or odd
even_f :: (Eq a,Num a) => (a -> a) -> a -> Bool
even_f f x | f x == f (-x) = True
| otherwise = False
odd_f :: (Eq a, Num a) => (a -> a) -> a -> Bool
odd_f f x | (-(f x)) == f (-x) = True
| otherwise = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment