fix typo in filter

This commit is contained in:
Scott Richmond 2025-06-12 17:52:44 -04:00
parent 1c650cf1bb
commit 71b139c048

View File

@ -261,7 +261,7 @@ fn map {
fn filter { fn filter {
"Takes a list and a predicate function, and returns a new list with only the items that produce truthy values when the function is called on them. E.g., `filter ([1, 2, 3, 4], odd?) &=> [1, 3]`. Also works on sets." "Takes a list and a predicate function, and returns a new list with only the items that produce truthy values when the function is called on them. E.g., `filter ([1, 2, 3, 4], odd?) &=> [1, 3]`. Also works on sets."
(p? as :fn) -> filter(p?, _) (p? as :fn) -> filter(p?, _)
(p? as :fn, xs as list) -> { (p? as :fn, xs as :list) -> {
fn filterer (filtered, x) -> if p? (x) fn filterer (filtered, x) -> if p? (x)
then append (filtered, x) then append (filtered, x)
else filtered else filtered