No title

1
2
3
4
5
6
-- approximation of e^x, using the first 10 terms of its series expansion
eto x = sum $ map ($ x) $ map nthTerm [0..9] where
  factorial 0 = 1
  factorial 1 = 1
  factorial n = foldl1 (*) [1..n]
  nthTerm n = (\x -> x^n / factorial n)