Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Find Euler's number
(use-modules (ice-9 format)) (define (fac n) (let repeat ((i 2) (res 1)) (if (> i n) res (repeat (+ i 1) (* res i))))) ;; if n is big enough, result will be more accurate (define (eulers-number n) (let calc ((i 0) (res 0)) (if (> i n) res (calc (+ i 1) (+ res (/ 1.0 (fac i))))))) (display (format #f "~0,12f" (eulers-number 144)))
run
|
edit
|
history
|
help
0
99 LISP PROBS
1.11
Infinite lists
Range List for Scheme
powerset
Toy implementation of classes using closures
Fibonacci in Scheme
Pruebas
So
Number of prime numbers in a list