mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-12-26 06:11:50 +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 : a -> List a -> (List a, List a)
|
||||||
partition x xs = (filter (< x) xs, filter (>= x) xs)
|
partition x xs = (filter (< x) xs, filter (>= x) xs)
|
||||||
|
|
||||||
sorted : Ord a => List a -> Bool
|
mySorted : Ord a => List a -> Bool
|
||||||
sorted [] = True
|
mySorted [] = True
|
||||||
sorted (x::xs) =
|
mySorted (x::xs) =
|
||||||
case xs of
|
case xs of
|
||||||
Nil => True
|
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
|
myMergeBy : (a -> a -> Ordering) -> List a -> List a -> List a
|
||||||
mergeBy order [] right = right
|
myMergeBy order [] right = right
|
||||||
mergeBy order left [] = left
|
myMergeBy order left [] = left
|
||||||
mergeBy order (x::xs) (y::ys) =
|
myMergeBy order (x::xs) (y::ys) =
|
||||||
case order x y of
|
case order x y of
|
||||||
LT => x :: mergeBy order xs (y::ys)
|
LT => x :: myMergeBy order xs (y::ys)
|
||||||
_ => y :: mergeBy order (x::xs) 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.qsortBad is not terminating due to recursive path Main.qsortBad -> Main.qsortBad
|
||||||
Main> Main.qsort is total
|
Main> Main.qsort is total
|
||||||
Main> Main.qsort' is total
|
Main> Main.qsort' is total
|
||||||
Main> Main.sorted is total
|
Main> Main.mySorted is total
|
||||||
Main> Main.mergeBy is total
|
Main> Main.myMergeBy is total
|
||||||
Main> Bye for now!
|
Main> Bye for now!
|
||||||
|
@ -13,6 +13,6 @@
|
|||||||
:total qsortBad
|
:total qsortBad
|
||||||
:total qsort
|
:total qsort
|
||||||
:total qsort'
|
:total qsort'
|
||||||
:total sorted
|
:total mySorted
|
||||||
:total mergeBy
|
:total myMergeBy
|
||||||
:q
|
:q
|
||||||
|
Loading…
Reference in New Issue
Block a user