;; some bootstrapping needed in order to obtain more complicated functions; ;; the power series requires a factorial and integer power function (bind powi (lambda (x y) (if (= y 1) x (* x (powi x (- y 1))) ) )) (bind inv (lambda (x) (/ 1.0 x))) (bind factorial (lambda (n) (if (= n 0) 1 (* n (factorial (- n 1)))))) ;; complicated functions (bind expr (lambda (x y) (if (<= y 0) 1 (+ (/ (powi x y) (factorial y)) (expr x (- y 1))) ) )) (bind exp (lambda (x) (expr x 13) )) (bind sin (lambda (x) x)) (bind cos (lambda (x) x)) (bind tan (lambda (x) (/ (sin x) (cos x)))) (print (exp 1.0)) ;(print (ln (exp 1)))