(operador parametro parametro)
(operador parametro
(operador parametro
parametro))
(defn fib [n]
(if (or (zero? n) (= n 1))
1
(+ (fib (dec n))
(fib (- n 2)))))
(time (fib 90))
; spent more than 30 minutes and I quit
(def fib-memo)
(defn fib [n]
(if (or (zero? n) (= n 1))
1
(+ (fib-memo (dec n))
(fib-memo (- n 2)))))
(def fib-memo (memoize fib))
(time (fib 90))
; "Elapsed time: 0.058 msecs"
(defn delayed-print []
(println "Dormiu")
(Thread/sleep 5000)
(println "Acordou"))
(-> delayed-print
Thread.
.start)