Skip to content

Commit

Permalink
reset includes
Browse files Browse the repository at this point in the history
  • Loading branch information
brekk committed Apr 19, 2024
1 parent 78975b5 commit 166db76
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions prelude/__internal__/List.mad
Original file line number Diff line number Diff line change
Expand Up @@ -783,28 +783,13 @@ export zip = (as, bs) => where(#[as, bs]) {
* @since 0.6.0
*/
includes :: Eq a => a -> List a -> Boolean
export includes = (x, list) => {
matched = false
subcheck = (lll) => if (!matched) {
where(lll) {
[] =>
{}

[a, ...xs] =>
do {
if (a == x) do {
matched := true
}
subcheck(xs)
}
}
}
subcheck(list)
return matched
}
// a == x ? true : includes(x, xs)

export includes = (x, list) => where(list) {
[] =>
false

[a, ...xs] =>
a == x || includes(x, xs)
}

/**
* Drops n items from the given list.
Expand Down

0 comments on commit 166db76

Please sign in to comment.