From ce586cbad4c8006f9cd65cb679ccbf640091002a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20Sinan=20K=C3=B6ksal?= <alisinan@gmail.com> Date: Tue, 8 Nov 2011 19:32:15 +0000 Subject: [PATCH] Curry testcases --- curry-testcases/RBT.curry | 3 ++- curry-testcases/SortedList.curry | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 curry-testcases/SortedList.curry diff --git a/curry-testcases/RBT.curry b/curry-testcases/RBT.curry index d01be478a..94aed3b77 100644 --- a/curry-testcases/RBT.curry +++ b/curry-testcases/RBT.curry @@ -42,4 +42,5 @@ isRBT t = (blackBalanced t) && (redNodesHaveBlackChildren t) valuesWithin :: Tree -> Int -> Bool valuesWithin Empty _ = True -valuesWithin (Node _ v l r) bound = 0 <= v && v <= bound && (valuesWithin l bound) && (valuesWithin r bound) +valuesWithin (Node _ v l r) bound = + 0 <= v && v <= bound && (valuesWithin l bound) && (valuesWithin r bound) diff --git a/curry-testcases/SortedList.curry b/curry-testcases/SortedList.curry new file mode 100644 index 000000000..d981bcbe1 --- /dev/null +++ b/curry-testcases/SortedList.curry @@ -0,0 +1,16 @@ +module SortedList + (isSorted, size + ) where + +isSorted :: [Int] -> Bool +isSorted [] = True +isSorted [_] = True +isSorted (x:y:ys) = x <= y && (isSorted (y:ys)) + +size :: [Int] -> Int +size [] = 0 +size (_:xs) = 1 + (size xs) + +contains :: [Int] -> Int -> Bool +contains [] _ = False +contains (x:xs) e = (x == e) || (contains xs e) -- GitLab