Advertisement
Madotsuki

Test functions

Sep 14th, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. doubleMe x = x + x
  2.  
  3. doubleUs x y = x*2 + y*2
  4.  
  5. doubleSmallNumber x = if x > 100
  6.                         then x
  7.                         else x*2
  8.                    
  9. happySad xs = [ if x < 10 then ":)" else ":(" | x <- xs, odd x]  
  10.  
  11. -- Sees what the difference from a to b is recursively, but only if
  12. -- a is bigger.
  13. -- That difference is appended onto a value input c.
  14. -- Example stepsFromBWithC 50 25 2
  15. -- Output would be 27, because it takes 25 steps to get to b, which
  16. -- would be appended onto c's original value of 2.
  17. stepsFromBWithC a b c = if a < b then
  18.                             c
  19.                         else
  20.                             let (whoa) = stepsFromBWithC (a-1) b c+1
  21.                             in whoa
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement