mirror of
https://github.com/HigherOrderCO/Kind1.git
synced 2024-09-11 08:45:32 +03:00
Added delete function to ListMap
This commit is contained in:
parent
3aaeb575cb
commit
34ae679f28
10
base/ListMap/delete.kind
Normal file
10
base/ListMap/delete.kind
Normal file
@ -0,0 +1,10 @@
|
||||
ListMap.delete<A: Type>(key: Nat, lm: ListMap<A>): ListMap<A>
|
||||
case lm {
|
||||
empty: ListMap.empty<A>
|
||||
cons:
|
||||
let map_key = lm.head@fst
|
||||
case Nat.eql(key, map_key) {
|
||||
true: lm.tail
|
||||
false: ListMap.cons<A>(lm.head, ListMap.delete<A>(key, lm.tail))
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user