Commit 8ddba0f1 authored by simonpj@microsoft.com's avatar simonpj@microsoft.com
Browse files

Moving list-length code from one place in the file to another

parent 0d7c6cea
...@@ -303,6 +303,18 @@ listLengthCmp = atLength atLen atEnd ...@@ -303,6 +303,18 @@ listLengthCmp = atLength atLen atEnd
atLen [] = EQ atLen [] = EQ
atLen _ = GT atLen _ = GT
equalLength :: [a] -> [b] -> Bool
equalLength [] [] = True
equalLength (_:xs) (_:ys) = equalLength xs ys
equalLength xs ys = False
compareLength :: [a] -> [b] -> Ordering
compareLength [] [] = EQ
compareLength (_:xs) (_:ys) = compareLength xs ys
compareLength [] _ys = LT
compareLength _xs [] = GT
----------------------------
singleton :: a -> [a] singleton :: a -> [a]
singleton x = [x] singleton x = [x]
...@@ -648,17 +660,6 @@ eqListBy eq [] [] = True ...@@ -648,17 +660,6 @@ eqListBy eq [] [] = True
eqListBy eq (x:xs) (y:ys) = eq x y && eqListBy eq xs ys eqListBy eq (x:xs) (y:ys) = eq x y && eqListBy eq xs ys
eqListBy eq xs ys = False eqListBy eq xs ys = False
equalLength :: [a] -> [b] -> Bool
equalLength [] [] = True
equalLength (_:xs) (_:ys) = equalLength xs ys
equalLength xs ys = False
compareLength :: [a] -> [b] -> Ordering
compareLength [] [] = EQ
compareLength (_:xs) (_:ys) = compareLength xs ys
compareLength [] _ys = LT
compareLength _xs [] = GT
cmpList :: (a -> a -> Ordering) -> [a] -> [a] -> Ordering cmpList :: (a -> a -> Ordering) -> [a] -> [a] -> Ordering
-- `cmpList' uses a user-specified comparer -- `cmpList' uses a user-specified comparer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment