all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Pittman <daniel@rimspace.net>
To: emacs-devel@gnu.org
Subject: Contributing (setf (assoc ...))
Date: Sat, 09 May 2009 23:55:46 +1000	[thread overview]
Message-ID: <87my9m4bz1.fsf@rimspace.net> (raw)

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





             reply	other threads:[~2009-05-09 13:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-09 13:55 Daniel Pittman [this message]
2009-05-09 14:23 ` Contributing (setf (assoc ...)) Lennart Borgman
2009-11-18 14:23 ` Stefan Monnier
2009-11-18 15:00   ` David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87my9m4bz1.fsf@rimspace.net \
    --to=daniel@rimspace.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.