Add 'see also' to `-find-index` and `-find-last-index`.

As discussed in #172 I find it easily to overlook `-first` when looking
at these functions.
master
Wilfred Hughes 10 years ago
parent 8a46d3c7c1
commit 6ded2f26be
  1. 6
      README.md
  2. 8
      dash.el

@ -442,6 +442,8 @@ Return a new list of the items in `list` for which `pred` returns a non-nil valu
Alias: `-select`
See also: [`-keep`](#-keep-fn-list)
```el
(-filter (lambda (num) (= 0 (% num 2))) '(1 2 3 4)) ;; => '(2 4)
(-filter 'even? '(1 2 3 4)) ;; => '(2 4)
@ -1237,6 +1239,8 @@ 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.
See also [`-first`](#-first-pred-list).
```el
(-find-index 'even? '(2 4 1 6 3 3 5 8)) ;; => 0
(--find-index (< 5 it) '(2 4 1 6 3 3 5 8)) ;; => 3
@ -1249,6 +1253,8 @@ Take a predicate `pred` and a `list` and return the index of the
last element in the list satisfying the predicate, or nil if
there is no such element.
See also [`-last`](#-last-pred-list).
```el
(-find-last-index 'even? '(2 4 1 6 3 3 5 8)) ;; => 7
(--find-last-index (< 5 it) '(2 7 1 6 3 8 5 2)) ;; => 5

@ -1159,7 +1159,9 @@ predicate PRED, in ascending order."
(defun -find-index (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."
there is no such element.
See also `-first'."
(car (-find-indices pred list)))
(defmacro --find-index (form list)
@ -1170,7 +1172,9 @@ there is no such element."
(defun -find-last-index (pred list)
"Take a predicate PRED and a LIST and return the index of the
last element in the list satisfying the predicate, or nil if
there is no such element."
there is no such element.
See also `-last'."
(-last-item (-find-indices pred list)))
(defmacro --find-last-index (form list)

Loading…
Cancel
Save