Merge branch 'lima' into master

This commit is contained in:
radrow
2020-10-13 10:22:05 +02:00
16 changed files with 193 additions and 96 deletions
+7 -2
View File
@@ -15,8 +15,8 @@ namespace List =
_::t => Some(t)
function last(l : list('a)) : option('a) = switch(l)
[] => None
[x] => Some(x)
[] => None
[x] => Some(x)
_::t => last(t)
function drop_last(l : list('a)) : option(list('a)) = switch(l)
@@ -28,6 +28,11 @@ namespace List =
h::t => h::drop_last_unsafe(t)
[] => abort("drop_last_unsafe: list empty")
function contains(e : 'a, l : list('a)) = switch(l)
[] => false
h::t => h == e || contains(e, t)
/** Finds first element of `l` fulfilling predicate `p` as `Some` or `None`
* if no such element exists.
*/