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)` #### -find-index `(pred list)`
Return the indices of all elements in `list` satisfying the Take a predicate `pred` and a `list` and return the index of the
predicate `pred`, in ascending order. first element in the list satisfying the predicate, or nil if
there is no such element.
```cl ```cl
(-find-index 'even? '(2 4 1 6 3 3 5 8)) ;; => 0 (-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)` #### -find-indices `(pred list)`
Take a predicate `pred` and a `list` and return the index of the Return the indices of all elements in `list` satisfying the
first element in the list satisfying the predicate, or nil if predicate `pred`, in ascending order.
there is no such element.
```cl ```cl
(-find-indices 'even? '(2 4 1 6 3 3 5 8)) ;; => '(0 1 3 7) (-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)) (-find-indices (-partial 'equal elem) list))
(defun -find-indices (pred list) (defun -find-indices (pred list)
"Take a predicate PRED and a LIST and return the index of the "Return the indices of all elements in LIST satisfying the
first element in the list satisfying the predicate, or nil if predicate PRED, in ascending order."
there is no such element."
(let ((i 0)) (let ((i 0))
(apply 'append (--map-indexed (when (funcall pred it) (list it-index)) list)))) (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)) `(-find-indices (lambda (it) ,form) ,list))
(defun -find-index (pred list) (defun -find-index (pred list)
"Return the indices of all elements in LIST satisfying the "Take a predicate PRED and a LIST and return the index of the
predicate PRED, in ascending order." first element in the list satisfying the predicate, or nil if
there is no such element."
(car (-find-indices pred list))) (car (-find-indices pred list)))
(defmacro --find-index (form list) (defmacro --find-index (form list)

Loading…
Cancel
Save