Subject: Re: My LOOP is ugly
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 25 Apr 2004 06:30:15 -0500
Newsgroups: comp.lang.lisp
Message-ID: <H6adnQNuK4TaPBbdRVn-sA@speakeasy.net>
Pascal Costanza  <costanza@web.de> wrote:
+---------------
| Recently I needed this, and found it very cool:
|   (incf (getf plist key 0))
| This means: If the key is not bound in plist yet, assume 0 as its 
| default value.
+---------------

And to bring this back around to hash tables (which the very
first responses in this thread suggested), for certain kinds
of text-processing tasks[1] I find myself doing this:

    (incf (gethash key ht 0))

or this:

    (push value (gethash key ht))	; NIL is fine as a default here


-Rob

[1] Histograms, checking for uniqueness, etc.

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607