help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mutate list by appending a list (and similar for props)


From: Stefan Monnier
Subject: Re: mutate list by appending a list (and similar for props)
Date: Thu, 18 Sep 2014 19:44:38 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> (define-modify-macro appendf (&rest args) append "Append onto list")

With GV, this would be

   (defmacro sm-appendf (place &rest args)
     (gv-letplace (getter setter) place
       (funcall setter `(append ,getter ,@args))))

> (defun prepend (dest-list &rest other-lists)
>   (apply (function append) (append other-lists (list dest-list))))
> (define-modify-macro prependf (&rest args) prepend "Prepend to list")

Which with GV would turn into

   (defmacro sm-appendf (place &rest args)
     (gv-letplace (getter setter) place
       (funcall setter `(append ,@args ,getter))))


-- Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]