unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Contributing (setf (assoc ...))
@ 2009-05-09 13:55 Daniel Pittman
  2009-05-09 14:23 ` Lennart Borgman
  2009-11-18 14:23 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Pittman @ 2009-05-09 13:55 UTC (permalink / raw)
  To: emacs-devel

G'day.

I recently wanted to update as associative list, but apparently Emacs
doesn't presently have an implementation of (setf (assoc ...)), at least
in the snapshot I use.

I believe I have paperwork on file already with the FSF for Emacs, even
assuming that this is large enough to require such paperwork:

(defsetf assoc (key place) (value)
  (let ((s1 (gensym)))
    `(let ((,s1 (assoc ,key ,place)))
       (if ,s1 (setf (second ,s1) ,value)
         (push (list ,key ,value) ,place)))))

That implementation should work fine in all circumstances, I believe,
and passes my local testing.

Um, generally speaking there doesn't seem to be anything like a test
suite for Emacs Lisp code that I could locate.  Did I miss something, or
is it generally the practice to just get it right? ;)

Regards,
        Daniel





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-18 15:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-09 13:55 Contributing (setf (assoc ...)) Daniel Pittman
2009-05-09 14:23 ` Lennart Borgman
2009-11-18 14:23 ` Stefan Monnier
2009-11-18 15:00   ` David Kastrup

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).