Merge branch 'trunk' into str_trim

This commit is contained in:
Folkert de Vries 2021-10-26 22:45:32 +02:00 committed by GitHub
commit 29bd4e3e50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1169 additions and 622 deletions

View file

@ -34,6 +34,7 @@ interface List
sortWith,
drop,
dropAt,
dropLast,
swap
]
imports []
@ -439,6 +440,9 @@ drop : List elem, Nat -> List elem
## To replace the element at a given index, instead of dropping it, see [List.set].
dropAt : List elem, Nat -> List elem
## Drops the last element in a List.
dropLast : List elem -> List elem
## Adds a new element to the end of the list.
##
## >>> List.append [ "a", "b" ] "c"

View file

@ -937,6 +937,13 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
Box::new(list_type(flex(TVAR1))),
);
// dropLast : List elem -> List elem
add_top_level_function_type!(
Symbol::LIST_DROP_LAST,
vec![list_type(flex(TVAR1))],
Box::new(list_type(flex(TVAR1))),
);
// swap : List elem, Nat, Nat -> List elem
add_top_level_function_type!(
Symbol::LIST_SWAP,