mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
Clarify that sequence/map functions don't alter their argument
* lisp/emacs-lisp/seq.el (seq-sort, seq-sort-by, seq-reverse) (seq-concatenate, seq-into-sequence, seq-into, seq-filter, seq-remove) (seq-remove-at-position, seq-reduce, seq-find, seq-uniq, seq-mapcat) (seq-partition, seq-union, seq-intersection, seq-difference) (seq-group-by, seq-split, seq-keep): * lisp/emacs-lisp/map.el (map-filter, map-remove, map-merge) (map-merge-with): Clarify that these functions don't modify their sequence/map arguments.
This commit is contained in:
parent
4204a9572a
commit
d40c754929
2 changed files with 47 additions and 23 deletions
|
|
@ -350,7 +350,8 @@ The default implementation delegates to `map-apply'."
|
|||
|
||||
(cl-defgeneric map-filter (pred map)
|
||||
"Return an alist of key/val pairs for which (PRED key val) is non-nil in MAP.
|
||||
The default implementation delegates to `map-apply'."
|
||||
The default implementation delegates to `map-apply'.
|
||||
This does not modify MAP."
|
||||
(delq nil (map-apply (lambda (key val)
|
||||
(and (funcall pred key val)
|
||||
(cons key val)))
|
||||
|
|
@ -358,7 +359,8 @@ The default implementation delegates to `map-apply'."
|
|||
|
||||
(cl-defgeneric map-remove (pred map)
|
||||
"Return an alist of the key/val pairs for which (PRED key val) is nil in MAP.
|
||||
The default implementation delegates to `map-filter'."
|
||||
The default implementation delegates to `map-filter'.
|
||||
This does not modify MAP."
|
||||
(map-filter (lambda (key val) (not (funcall pred key val)))
|
||||
map))
|
||||
|
||||
|
|
@ -457,7 +459,8 @@ MAP may be of a type other than TYPE."
|
|||
|
||||
(defun map-merge (type &rest maps)
|
||||
"Merge into a map of TYPE all the key/value pairs in MAPS.
|
||||
See `map-into' for all supported values of TYPE."
|
||||
See `map-into' for all supported values of TYPE.
|
||||
This does not modify any of the MAPS."
|
||||
(apply #'map--merge
|
||||
(lambda (result key value)
|
||||
(setf (map-elt result key) value)
|
||||
|
|
@ -469,7 +472,8 @@ See `map-into' for all supported values of TYPE."
|
|||
When two maps contain the same key, call FUNCTION on the two
|
||||
values and use the value FUNCTION returns.
|
||||
Each of MAPS can be an alist, plist, hash-table, or array.
|
||||
See `map-into' for all supported values of TYPE."
|
||||
See `map-into' for all supported values of TYPE.
|
||||
This does not modify any of the MAPS."
|
||||
(let ((not-found (list nil)))
|
||||
(apply #'map--merge
|
||||
(lambda (result key value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue