Skip to content

Instantly share code, notes, and snippets.

@adilakhter
Created June 9, 2011 19:25
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 adilakhter/1017508 to your computer and use it in GitHub Desktop.
Save adilakhter/1017508 to your computer and use it in GitHub Desktop.
test
module Main where
a = b+c
where
b = 1
c = 2
d = a * 2
factorial n= product [1..n]
average ns = sum ns `div` length ns
doubleme x= x + x
doubleus x y = x*2 + y*2
doubleSmallNumber x = if x> 100 then x else x*2
doublesmallnumber x = 1 + if x> 100 then x else x*2
power x 1 = x
power x 0 = 1
power x n
| ( rem n 2) == 0 = square (power x ( n`div` 2))
| otherwise = x * square (power x ( n`div` 2 ))
where
square n = ( n* n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment