We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 30c73be + 0969073 commit bd80979Copy full SHA for bd80979
tests/scott-lists/solution.txt
@@ -202,6 +202,13 @@ insert-by = \ le x xs . uncurry append (second (cons x) (span (C le x) xs))
202
sort-by = \ le . foldr (insert-by le) nil
203
# has all sorts of bad implementation details, but it's simple
204
205
+# compare-by :: (a -> a -> Ordering) -> List a -> List a -> Ordering
206
+compare-by = \ cmp xs ys . xs (ys EQ LT)
207
+ \ x xs . ys GT
208
+ \ y ys . cmp x y LT
209
+ (compare-by cmp xs ys)
210
+ GT
211
+
212
# reverse :: List a -> List a
213
reverse = foldl (C cons) nil
214
0 commit comments