packages feed

code-conjure-0.5.2: eg/count.out

count :: A -> [A] -> Int
-- testing 13 combinations of argument values
-- pruning with 1/2 rules
-- looking through 0 candidates of size 1
-- looking through 1 candidates of size 2
-- looking through 0 candidates of size 3
-- looking through 0 candidates of size 4
-- looking through 1 candidates of size 5
-- tested 2 candidates
count x xs  =  length (filter (x ==) xs)

count :: A -> [A] -> Int
-- testing 13 combinations of argument values
-- pruning with 8/13 rules
-- looking through 2 candidates of size 1
-- looking through 2 candidates of size 2
-- looking through 1 candidates of size 3
-- looking through 8 candidates of size 4
-- looking through 9 candidates of size 5
-- looking through 24 candidates of size 6
-- looking through 46 candidates of size 7
-- looking through 114 candidates of size 8
-- looking through 272 candidates of size 9
-- looking through 648 candidates of size 10
-- looking through 1549 candidates of size 11
-- tested 1751 candidates
count x []  =  0
count x (y:xs)  =  (if x == y then 1 else 0) + count x xs