From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Roderick Newsgroups: gmane.emacs.help Subject: predicates on lists Date: Wed, 26 Mar 2008 12:20:04 +0000 Message-ID: NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1206557173 17775 80.91.229.10 (26 Mar 2008 18:46:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Mar 2008 18:46:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 26 20:03:02 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1Jeatp-0000MH-GW for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Mar 2008 20:03:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JeadO-00081L-0i for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Mar 2008 14:46:02 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!goblin1!goblin.stu.neva.ru!uio.no!quimby.gnus.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Original-NNTP-Posting-Host: 79-73-140-118.dynamic.dsl.as9105.com Original-X-Trace: quimby.gnus.org 1206534042 4615 79.73.140.118 (26 Mar 2008 12:20:42 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Wed, 26 Mar 2008 12:20:42 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.990 (windows-nt) Cancel-Lock: sha1:13PQI+7CREo+R2iiDB3dLOg+iJ0= Original-Xref: shelby.stanford.edu gnu.emacs.help:157335 X-Mailman-Approved-At: Wed, 26 Mar 2008 14:41:19 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:52713 Archived-At: Elisp 5.8 -- Function: assoc-default key alist &optional test default This function searches ALIST for a match for KEY. For each element of ALIST, it compares the element (if it is an atom) or the element's CAR (if it is a cons) against KEY, by calling TEST with two arguments: the element or its CAR, and KEY. The arguments are passed in that order so that you can get useful results using `string-match' with an alist that contains regular expressions (*note Regexp Search::). If TEST is omitted or `nil', `equal' is used for comparison. I am a bit confused. I thought that an element inside of an associated list is a dotted pair of its CAR and CDR, and the KEY is the CAR. The argument as key in the above function confused me. Having solved this problem, and realizing that this function is complicated, am I correct in thinking that an atom is (atom OBJECT) == (not (consp OBJECT)) This is confusing because an atom is a fundamental building block outside of Elisp, and a cons cell is a fundamental building block by Elisp. It seems that anything which is not a cons cell should be a molecule. Ok, now that I have got this silly questioning over and done with, a further query arises in my brain. you can get useful results using `string-match' with an alist that contains regular expressions (*note Regexp Search::). Does the string-match contain a regular expression or does the alisp contain a regular expression? My guess is the string-match may contain a regular expression, but this process of deduction might be eliminated if the explanation was revised. -- from David Roderick