Merge pull request #3 from rejeep/join-alias

Add -uniq as alias to -distinct
master
Magnar Sveen 14 years ago
commit d857f73d73
  1. 2
      README.md
  2. 6
      dash.el

@ -425,6 +425,8 @@ Return a new list with all duplicates removed.
The test for equality is done with `equal`,
or with `-compare-fn` if that's non-nil.
Alias: `-uniq`
```cl
(-distinct '()) ;; => '()
(-distinct '(1 2 2 4)) ;; => '(1 2 4)

@ -468,11 +468,15 @@ in in second form, etc."
(defun -distinct (list)
"Return a new list with all duplicates removed.
The test for equality is done with `equal',
or with `-compare-fn' if that's non-nil."
or with `-compare-fn' if that's non-nil.
Alias: `-uniq'"
(let (result)
(--each list (when (not (-contains? result it)) (!cons it result)))
(nreverse result)))
(defalias '-uniq '-distinct)
(defun -intersection (list list2)
"Return a new list containing only the elements that are members of both LIST and LIST2.
The test for equality is done with `equal',

Loading…
Cancel
Save