mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-22 03:01:31 +03:00
e58bcfc7ef
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
23 lines
422 B
Idris
23 lines
422 B
Idris
module Case
|
|
|
|
listId : List a -> List a
|
|
listId xs = case xs of
|
|
[] => []
|
|
(x :: xs) => x :: listId xs
|
|
|
|
listRev : List a -> List a
|
|
listRev = \case
|
|
[] => []
|
|
(x :: xs) => listRev xs ++ [x]
|
|
|
|
listFilter2 : (p, q : a -> Bool) -> List a -> List a
|
|
listFilter2 p q xs
|
|
= do x <- xs
|
|
-- let pat
|
|
let True = p x
|
|
| False => []
|
|
-- do pat
|
|
True <- pure (q x)
|
|
| False => []
|
|
pure x
|