gt22 icon

Untitled

gt22 | PRO | 09/28/20 04:06:40 PM UTC (Edited) | 0 ⭐ | 659 👁️ | Never ⏰ | []
text |

500 B

|

None

|

0 👍

/

0 👎

triple x = 3 * x
sgn x | x > 0 = 1
      | x < 0 = -1
      | otherwise = 0
 nor :: Bool -> Bool -> Bool
nor False False = True
nor _     _     = False
 nand :: Bool -> Bool -> Bool
nand True True = False
nand _    _    = True
 fib 0 = 0
fib 1 = 1
fib n = fib (n - 1) + fib (n - 2)
 fib' n = fib'' 0 1 n
       where fib'' a _ 0 = a
             fib'' a b n = fib'' b (a+b) (n-1)
  fac' _ 0 = 1
fac' f n = n * f (n - 1)
fac = fix fac'
  sumsq = on (+) (^2)

Comments