unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* predicates on lists
@ 2008-03-26 12:20 David Roderick
  2008-03-27  5:07 ` Barry Margolin
  0 siblings, 1 reply; 3+ messages in thread
From: David Roderick @ 2008-03-26 12:20 UTC (permalink / raw)
  To: help-gnu-emacs


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


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

end of thread, other threads:[~2008-03-27 14:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-26 12:20 predicates on lists David Roderick
2008-03-27  5:07 ` Barry Margolin
2008-03-27 14:43   ` David Roderick

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).