Skip to content

Instantly share code, notes, and snippets.

@solomon081
Created July 19, 2012 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solomon081/3140466 to your computer and use it in GitHub Desktop.
Save solomon081/3140466 to your computer and use it in GitHub Desktop.
Haskell Experiments
ordered :: Int -> Int -> (Int, Int)
ordered x y
| x >= y = (x, y)
| otherwise = (y, x)
sumAndProduct :: Int -> Int -> (Int, Int)
sumAndProduct x y = (x + y, x * y)
shift :: ((Int, Int), Int) -> (Int, (Int, Int))
shift ((x, y), z) = (x, (y, z))
udRange :: Int -> Int -> (Int, Int, Int)
udRange fixed range = (fixed - range, fixed, fixed + range)
inRange :: Int -> Int -> Int -> Bool
inRange b t fixed
| (fixed > t) || (fixed < b) = False
| otherwise = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment