mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Merge branch 'trunk' into str_trim
This commit is contained in:
commit
29bd4e3e50
14 changed files with 1169 additions and 622 deletions
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue