Merge pull request #3369 from rtfeldman/pure-roc-list-walk

List.walk and friends in pure Roc
This commit is contained in:
Folkert de Vries 2022-07-03 02:32:43 +02:00 committed by GitHub
commit 2a82d24847
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 344 additions and 1630 deletions

View file

@ -36,14 +36,10 @@ pub enum LowLevel {
ListMap3,
ListMap4,
ListMapWithIndex,
ListWalk,
ListWalkUntil,
ListWalkBackwards,
ListSortWith,
ListSublist,
ListDropAt,
ListSwap,
ListFindUnsafe,
ListIsUnique,
DictSize,
DictEmpty,
@ -124,17 +120,7 @@ pub enum LowLevel {
macro_rules! higher_order {
() => {
ListMap
| ListMap2
| ListMap3
| ListMap4
| ListMapWithIndex
| ListWalk
| ListWalkUntil
| ListWalkBackwards
| ListSortWith
| ListFindUnsafe
| DictWalk
ListMap | ListMap2 | ListMap3 | ListMap4 | ListMapWithIndex | ListSortWith | DictWalk
};
}
@ -156,11 +142,7 @@ impl LowLevel {
ListMap3 => 3,
ListMap4 => 4,
ListMapWithIndex => 1,
ListWalk => 2,
ListWalkUntil => 2,
ListWalkBackwards => 2,
ListSortWith => 1,
ListFindUnsafe => 1,
DictWalk => 2,
_ => unreachable!(),
}
@ -225,9 +207,6 @@ impl LowLevelWrapperType {
Symbol::LIST_MAP3 => WrapperIsRequired,
Symbol::LIST_MAP4 => WrapperIsRequired,
Symbol::LIST_MAP_WITH_INDEX => WrapperIsRequired,
Symbol::LIST_WALK => WrapperIsRequired,
Symbol::LIST_WALK_UNTIL => WrapperIsRequired,
Symbol::LIST_WALK_BACKWARDS => WrapperIsRequired,
Symbol::LIST_SORT_WITH => WrapperIsRequired,
Symbol::LIST_SUBLIST => WrapperIsRequired,
Symbol::LIST_DROP_AT => CanBeReplacedBy(ListDropAt),