Fix switched around doc strings for -find-index/indices

master
Magnar Sveen 13 years ago
parent 6cc7727c9d
commit 6d43c4f987
  1. 10
      README.md
  2. 10
      dash.el

@ -715,8 +715,9 @@ element `elem`, in ascending order.
#### -find-index `(pred list)`
Return the indices of all elements in `list` satisfying the
predicate `pred`, in ascending order.
Take a predicate `pred` and a `list` and return the index of the
first element in the list satisfying the predicate, or nil if
there is no such element.
```cl
(-find-index 'even? '(2 4 1 6 3 3 5 8)) ;; => 0
@ -726,9 +727,8 @@ predicate `pred`, in ascending order.
#### -find-indices `(pred list)`
Take a predicate `pred` and a `list` and return the index of the
first element in the list satisfying the predicate, or nil if
there is no such element.
Return the indices of all elements in `list` satisfying the
predicate `pred`, in ascending order.
```cl
(-find-indices 'even? '(2 4 1 6 3 3 5 8)) ;; => '(0 1 3 7)

@ -709,9 +709,8 @@ element ELEM, in ascending order."
(-find-indices (-partial 'equal elem) list))
(defun -find-indices (pred list)
"Take a predicate PRED and a LIST and return the index of the
first element in the list satisfying the predicate, or nil if
there is no such element."
"Return the indices of all elements in LIST satisfying the
predicate PRED, in ascending order."
(let ((i 0))
(apply 'append (--map-indexed (when (funcall pred it) (list it-index)) list))))
@ -720,8 +719,9 @@ there is no such element."
`(-find-indices (lambda (it) ,form) ,list))
(defun -find-index (pred list)
"Return the indices of all elements in LIST satisfying the
predicate PRED, in ascending order."
"Take a predicate PRED and a LIST and return the index of the
first element in the list satisfying the predicate, or nil if
there is no such element."
(car (-find-indices pred list)))
(defmacro --find-index (form list)

Loading…
Cancel
Save