mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-12-25 05:43:19 +03:00
Fix Total004 test
Names in Data.List clashed
This commit is contained in:
parent
62382dcd96
commit
fc224b1450
@ -111,17 +111,17 @@ qsort' (x :: xs)
|
||||
partition : a -> List a -> (List a, List a)
|
||||
partition x xs = (filter (< x) xs, filter (>= x) xs)
|
||||
|
||||
sorted : Ord a => List a -> Bool
|
||||
sorted [] = True
|
||||
sorted (x::xs) =
|
||||
mySorted : Ord a => List a -> Bool
|
||||
mySorted [] = True
|
||||
mySorted (x::xs) =
|
||||
case xs of
|
||||
Nil => True
|
||||
(y::ys) => x <= y && sorted (y::ys)
|
||||
(y::ys) => x <= y && mySorted (y::ys)
|
||||
|
||||
mergeBy : (a -> a -> Ordering) -> List a -> List a -> List a
|
||||
mergeBy order [] right = right
|
||||
mergeBy order left [] = left
|
||||
mergeBy order (x::xs) (y::ys) =
|
||||
myMergeBy : (a -> a -> Ordering) -> List a -> List a -> List a
|
||||
myMergeBy order [] right = right
|
||||
myMergeBy order left [] = left
|
||||
myMergeBy order (x::xs) (y::ys) =
|
||||
case order x y of
|
||||
LT => x :: mergeBy order xs (y::ys)
|
||||
_ => y :: mergeBy order (x::xs) ys
|
||||
LT => x :: myMergeBy order xs (y::ys)
|
||||
_ => y :: myMergeBy order (x::xs) ys
|
||||
|
@ -15,6 +15,6 @@ Main> Main.size is total
|
||||
Main> Main.qsortBad is not terminating due to recursive path Main.qsortBad -> Main.qsortBad
|
||||
Main> Main.qsort is total
|
||||
Main> Main.qsort' is total
|
||||
Main> Main.sorted is total
|
||||
Main> Main.mergeBy is total
|
||||
Main> Main.mySorted is total
|
||||
Main> Main.myMergeBy is total
|
||||
Main> Bye for now!
|
||||
|
@ -13,6 +13,6 @@
|
||||
:total qsortBad
|
||||
:total qsort
|
||||
:total qsort'
|
||||
:total sorted
|
||||
:total mergeBy
|
||||
:total mySorted
|
||||
:total myMergeBy
|
||||
:q
|
||||
|
Loading…
Reference in New Issue
Block a user