Idris2/tests/ideMode/ideMode005/LetBinders.idr
2021-05-17 22:27:28 +01:00

28 lines
476 B
Idris

module LetBinders
infix 1 :::
record List1 (a : Type) where
constructor (:::)
head : a
tail : List a
swap : List1 a -> List1 a
swap aas =
let (a ::: as) := aas in
let (b :: bs) = as
| [] => a ::: []
rest = a :: bs
in b ::: rest
identity : List (Nat, a) -> List (List a)
identity =
let
replicate : (n : Nat) -> a -> List a
replicate Z a = []
replicate (S n) a = a :: replicate n a
closure := uncurry replicate
in map closure