diff options
| author | Nicolas Petton | 2015-09-06 00:51:35 +0200 |
|---|---|---|
| committer | Nicolas Petton | 2015-09-06 00:51:35 +0200 |
| commit | 1b5fda5cbca96aec3e407bc9e4f8a16e48e7954c (patch) | |
| tree | d85433211e2e19cf00ea34a4b06db3ef1e4c49e6 /lisp | |
| parent | a1535f938181ea137037d0233924a2c9d9e08f76 (diff) | |
| download | emacs-1b5fda5cbca96aec3e407bc9e4f8a16e48e7954c.tar.gz emacs-1b5fda5cbca96aec3e407bc9e4f8a16e48e7954c.zip | |
Improve the semantic of map-some
Update map-some to return the returned by the predicate, similar to
seq-some.
* lisp/emacs-lisp/map.el (map-some): Update the function to return the
return value of the predicate.
* test/automated/map-tests.el (test-map-some): Update the test to check
for non-nil values only.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/map.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index 4e7d3b91b16..ea56efefe97 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el | |||
| @@ -262,8 +262,9 @@ MAP can be a list, hash-table or array." | |||
| 262 | MAP can be a list, hash-table or array." | 262 | MAP can be a list, hash-table or array." |
| 263 | (catch 'map--break | 263 | (catch 'map--break |
| 264 | (map-apply (lambda (key value) | 264 | (map-apply (lambda (key value) |
| 265 | (when (funcall pred key value) | 265 | (let ((result (funcall pred key value))) |
| 266 | (throw 'map--break (cons key value)))) | 266 | (when result |
| 267 | (throw 'map--break result)))) | ||
| 267 | map) | 268 | map) |
| 268 | nil)) | 269 | nil)) |
| 269 | 270 | ||