packages feed

code-conjure-0.4.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
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 44 candidates of size 7
-- looking through 108 candidates of size 8
-- looking through 244 candidates of size 9
-- looking through 574 candidates of size 10
-- looking through 1320 candidates of size 11
count x []  =  0
count x (y:xs)  =  (if x == y then 1 else 0) + count x xs