1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-25 22:53:16 +00:00

Merge pull request #522 from pyrmont/docs.keep-docstring

Clarify description of keep
This commit is contained in:
Calvin Rose 2020-12-05 14:31:58 -06:00 committed by GitHub
commit 7e1d095996
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -945,8 +945,10 @@
counter)
(defn keep
`Given a predicate, take only elements from an array or tuple for
which (pred element) is truthy. Returns a new array of truthy predicate results.`
``Given a predicate `pred`, return a new array containing the truthy results
of applying `pred` to each element in the indexed collection `ind`. This is
different from `filter` which returns an array of the original elements where
the predicate is truthy.``
[pred ind]
(def res @[])
(each item ind