packages feed

code-conjure-0.5.4: eg/tree.out

leftmost :: Tree -> Int
-- testing 360 combinations of argument values
-- pruning with 3/3 rules
-- looking through 1 candidates of size 1
-- looking through 1 candidates of size 2
-- looking through 2 candidates of size 3
-- looking through 0 candidates of size 4
-- looking through 0 candidates of size 5
-- looking through 4 candidates of size 6
-- looking through 16 candidates of size 7
-- tested 9 candidates
leftmost Leaf  =  undefined
leftmost (Node t1 x t2)  =  if nil t1 then x else leftmost t1

rightmost :: Tree -> Int
-- testing 360 combinations of argument values
-- pruning with 3/3 rules
-- looking through 1 candidates of size 1
-- looking through 1 candidates of size 2
-- looking through 2 candidates of size 3
-- looking through 0 candidates of size 4
-- looking through 0 candidates of size 5
-- looking through 4 candidates of size 6
-- looking through 16 candidates of size 7
-- tested 18 candidates
rightmost Leaf  =  undefined
rightmost (Node t1 x t2)  =  if nil t2 then x else rightmost t2

size :: Tree -> Int
-- testing 360 combinations of argument values
-- pruning with 4/8 rules
-- looking through 2 candidates of size 1
-- looking through 2 candidates of size 2
-- looking through 3 candidates of size 3
-- looking through 4 candidates of size 4
-- looking through 9 candidates of size 5
-- looking through 12 candidates of size 6
-- looking through 25 candidates of size 7
-- looking through 40 candidates of size 8
-- tested 71 candidates
size Leaf  =  0
size (Node t1 x t2)  =  size t1 + (size t2 + 1)

height :: Tree -> Int
-- testing 360 combinations of argument values
-- pruning with 49/65 rules
-- looking through 3 candidates of size 1
-- looking through 3 candidates of size 2
-- looking through 4 candidates of size 3
-- looking through 13 candidates of size 4
-- looking through 30 candidates of size 5
-- looking through 88 candidates of size 6
-- looking through 320 candidates of size 7
-- looking through 1093 candidates of size 8
-- tested 475 candidates
height Leaf  =  -1
height (Node t1 x t2)  =  max (height t1) (height t2) + 1

mem :: Int -> Tree -> Bool
-- testing 360 combinations of argument values
-- pruning with 11/17 rules
-- looking through 1 candidates of size 1
-- looking through 0 candidates of size 2
-- looking through 0 candidates of size 3
-- looking through 6 candidates of size 4
-- looking through 0 candidates of size 5
-- looking through 0 candidates of size 6
-- looking through 0 candidates of size 7
-- looking through 34 candidates of size 8
-- looking through 0 candidates of size 9
-- looking through 0 candidates of size 10
-- looking through 0 candidates of size 11
-- looking through 184 candidates of size 12
-- tested 107 candidates
mem x Leaf  =  False
mem x (Node t1 y t2)  =  mem x t1 || (x == y || mem x t2)

ordered :: Tree -> Bool
-- testing 360 combinations of argument values
-- pruning with 29/39 rules
-- looking through 2 candidates of size 1
-- looking through 1 candidates of size 2
-- looking through 2 candidates of size 3
-- looking through 0 candidates of size 4
-- looking through 10 candidates of size 5
-- looking through 20 candidates of size 6
-- looking through 0 candidates of size 7
-- looking through 64 candidates of size 8
-- looking through 144 candidates of size 9
-- looking through 112 candidates of size 10
-- looking through 964 candidates of size 11
-- looking through 1480 candidates of size 12
-- tested 2799 candidates
cannot conjure

ordered :: Tree -> Bool
-- testing 360 combinations of argument values
-- pruning with 0/0 rules
-- looking through 0 candidates of size 1
-- looking through 0 candidates of size 2
-- looking through 3 candidates of size 3
-- tested 3 candidates
ordered t1  =  strictlyOrdered (inorder t1)

preorder :: Tree -> [Int]
-- testing 360 combinations of argument values
-- pruning with 4/4 rules
-- looking through 1 candidates of size 1
-- looking through 0 candidates of size 2
-- looking through 2 candidates of size 3
-- looking through 1 candidates of size 4
-- looking through 2 candidates of size 5
-- looking through 5 candidates of size 6
-- looking through 4 candidates of size 7
-- looking through 9 candidates of size 8
-- tested 17 candidates
preorder Leaf  =  []
preorder (Node t1 x t2)  =  x:(preorder t1 ++ preorder t2)

inorder :: Tree -> [Int]
-- testing 360 combinations of argument values
-- pruning with 4/4 rules
-- looking through 1 candidates of size 1
-- looking through 0 candidates of size 2
-- looking through 2 candidates of size 3
-- looking through 1 candidates of size 4
-- looking through 2 candidates of size 5
-- looking through 5 candidates of size 6
-- looking through 4 candidates of size 7
-- looking through 9 candidates of size 8
-- tested 21 candidates
inorder Leaf  =  []
inorder (Node t1 x t2)  =  inorder t1 ++ (x:inorder t2)

posorder :: Tree -> [Int]
-- testing 360 combinations of argument values
-- pruning with 4/4 rules
-- looking through 1 candidates of size 1
-- looking through 0 candidates of size 2
-- looking through 2 candidates of size 3
-- looking through 1 candidates of size 4
-- looking through 2 candidates of size 5
-- looking through 5 candidates of size 6
-- looking through 4 candidates of size 7
-- looking through 9 candidates of size 8
-- looking through 14 candidates of size 9
-- looking through 17 candidates of size 10
-- tested 52 candidates
posorder Leaf  =  []
posorder (Node t1 x t2)  =  posorder t1 ++ (posorder t2 ++ [x])