packages feed

code-conjure-0.4.0: eg/fibonacci.out

fibonacci :: Int -> Int
-- testing 8 combinations of argument values
-- pruning with 20/38 rules
-- looking through 2 candidates of size 1
-- looking through 2 candidates of size 2
-- looking through 6 candidates of size 3
-- looking through 1 candidates of size 4
-- looking through 11 candidates of size 5
-- looking through 5 candidates of size 6
-- looking through 27 candidates of size 7
-- looking through 20 candidates of size 8
-- looking through 95 candidates of size 9
-- looking through 172 candidates of size 10
-- looking through 519 candidates of size 11
-- looking through 1281 candidates of size 12
-- looking through 3289 candidates of size 13
fibonacci n  =  if n <= 1 then 1 else fibonacci (dec n) + fibonacci (dec (dec n))

fib01 :: Int -> Int -> Int -> Int
-- testing 8 combinations of argument values
-- pruning with 18/37 rules
-- looking through 4 candidates of size 1
-- looking through 4 candidates of size 2
-- looking through 9 candidates of size 3
-- looking through 21 candidates of size 4
-- looking through 43 candidates of size 5
-- looking through 84 candidates of size 6
-- looking through 192 candidates of size 7
-- looking through 391 candidates of size 8
-- looking through 840 candidates of size 9
-- looking through 9294 candidates of size 10
-- looking through 45295 candidates of size 11
-- looking through 215844 candidates of size 12
fib01 x y z  =  if z <= 0 then y else fib01 y (x + y) (dec z)