branch: externals/dash commit b308794148a779c07a120a57df0a09d900d8e087 Author: Matus Goljer <dota.k...@gmail.com> Commit: Matus Goljer <dota.k...@gmail.com>
[Fix #73] Add a mention of -filter to -keep docstring --- README.md | 2 ++ dash.el | 4 +++- dash.texi | 2 ++ 3 files changed, 7 insertions(+), 1 deletions(-) diff --git a/README.md b/README.md index 50fcfae..78ac7d5 100644 --- a/README.md +++ b/README.md @@ -514,6 +514,8 @@ Bag of various functions which modify input list. Return a new list of the non-nil results of applying `fn` to the items in `list`. +If you want to select the original items satisfying a predicate use [`-filter`](#-filter-pred-list). + ```el (-keep 'cdr '((1 2 3) (4 5) (6))) ;; => '((2 3) (5)) (-keep (lambda (num) (when (> num 3) (* 10 num))) '(1 2 3 4 5 6)) ;; => '(40 50 60) diff --git a/dash.el b/dash.el index 1029ef2..000d575 100644 --- a/dash.el +++ b/dash.el @@ -242,7 +242,9 @@ Comparison is done with `equal'." (nreverse ,r)))) (defun -keep (fn list) - "Return a new list of the non-nil results of applying FN to the items in LIST." + "Return a new list of the non-nil results of applying FN to the items in LIST. + +If you want to select the original items satisfying a predicate use `-filter'." (--keep (funcall fn it) list)) (defun -non-nil (list) diff --git a/dash.texi b/dash.texi index 7fd4a5c..08f5b22 100644 --- a/dash.texi +++ b/dash.texi @@ -589,6 +589,8 @@ Bag of various functions which modify input list. @defun -keep (fn list) Return a new list of the non-nil results of applying @var{fn} to the items in @var{list}. +If you want to select the original items satisfying a predicate use @code{-filter} (@pxref{-filter}). + @example @group (-keep 'cdr '((1 2 3) (4 5) (6)))