branch: externals/dash commit bcc74b56cc90842cb120015632b37eeffcaa4b9a Author: Matus Goljer <gol...@logio.cz> Commit: Matus Goljer <gol...@logio.cz>
[#200] Define setters for -first-item and -last-item --- dash.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dash.el b/dash.el index 0747eb8..27dd2c1 100644 --- a/dash.el +++ b/dash.el @@ -578,11 +578,15 @@ Alias: `-any'" \(fn LIST)") +(gv-define-simple-setter -first-item setcar) + (defun -last-item (list) "Return the last item of LIST, or nil on an empty list." (declare (pure t) (side-effect-free t)) (car (last list))) +(gv-define-setter -last-item (val x) `(setcar (last ,x) ,val)) + (defun -butlast (list) "Return a list of all items in list except for the last." ;; no alias as we don't want magic optional argument