File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 5353# =begin
5454# (math:fibo 45 0 1)
5555# =end
56- (let math:fibo (fun (n p c ) {
57- (if (<= n 0 )
58- 0
59- (if (= n 1)
60- c
61- (math:fibo (- n 1) c (+ p c))) )}))
56+ (let math:fibo (fun (n) {
57+ (let impl (fun (n p c )
58+ (if (<= n 0) 0
59+ (if (= n 1) c
60+ (impl (- n 1) c (+ p c))))))
61+ (impl n 0 1 )}))
6262
6363# @brief Returns the list of a number's divisors
6464# @param n the number
Original file line number Diff line number Diff line change 2121 (set tests (assert-eq (math:pow 2 2) 4 "math:pow" tests))
2222 (set tests (assert-eq (math:pow 4 0.5) 2 "math:pow" tests))
2323 # small trick with toNumber because we have number's approximation because of the underlying double
24- (set tests (assert-eq (math:fibo 31 0 1 ) (toNumber "1346269") "math:fibo" tests))
24+ (set tests (assert-eq (math:fibo 31) (toNumber "1346269") "math:fibo" tests))
2525 # small trick with toNumber because we have number's approximation because of the underlying double
26- (set tests (assert-eq (math:fibo 32 0 1 ) (toNumber "2178309") "math:fibo" tests))
26+ (set tests (assert-eq (math:fibo 32) (toNumber "2178309") "math:fibo" tests))
2727 (set tests (assert-eq (math:divs 6) [1 2 3 6] "math:divs" tests))
2828 (set tests (assert-eq (math:divs 2) [1 2] "math:divs" tests))
2929 (set tests (assert-eq (math:divs 931) [1 7 19 49 133 931] "math:divs" tests))
You can’t perform that action at this time.
0 commit comments