duplicates :: [Int] -> [Int]
-- testing 6 combinations of argument values
-- pruning with 21/26 rules
-- 2 candidates of size 1
-- 0 candidates of size 2
-- 0 candidates of size 3
-- 0 candidates of size 4
-- 1 candidates of size 5
-- 0 candidates of size 6
-- 1 candidates of size 7
-- 6 candidates of size 8
-- 5 candidates of size 9
-- 16 candidates of size 10
-- 11 candidates of size 11
-- 26 candidates of size 12
-- 23 candidates of size 13
-- 52 candidates of size 14
-- 49 candidates of size 15
-- 78 candidates of size 16
-- 75 candidates of size 17
-- tested 271 candidates
duplicates []  =  []
duplicates (x:xs)
  | elem x xs && not (elem x (duplicates xs))  =  x:duplicates xs
  | otherwise  =  duplicates xs

duplicates :: [Int] -> [Int]
-- pruning with 21/26 rules
-- 2 candidates of size 1
-- 1 candidates of size 2
-- 0 candidates of size 3
-- 2 candidates of size 4
-- 1 candidates of size 5
-- 2 candidates of size 6
-- 3 candidates of size 7
-- 8 candidates of size 8
-- 13 candidates of size 9
-- 18 candidates of size 10
-- 21 candidates of size 11
-- 28 candidates of size 12
-- 39 candidates of size 13
-- 54 candidates of size 14
-- 67 candidates of size 15
-- 80 candidates of size 16
-- 99 candidates of size 17
-- tested 340 candidates
duplicates []  =  []
duplicates (x:xs)
  | elem x xs && not (elem x (duplicates xs))  =  x:duplicates xs
  | otherwise  =  duplicates xs

positionsFrom :: Int -> A -> [A] -> [Int]
-- testing 360 combinations of argument values
-- pruning with 5/10 rules
-- 1 candidates of size 1
-- 0 candidates of size 2
-- 2 candidates of size 3
-- 0 candidates of size 4
-- 7 candidates of size 5
-- 0 candidates of size 6
-- 34 candidates of size 7
-- 0 candidates of size 8
-- 133 candidates of size 9
-- 0 candidates of size 10
-- 510 candidates of size 11
-- 16 candidates of size 12
-- 1947 candidates of size 13
-- 104 candidates of size 14
-- tested 2653 candidates
positionsFrom x y []  =  []
positionsFrom x y (z:xs)  =  (if y == z then (x :) else id) (positionsFrom (x + 1) y xs)

