home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dove!dove.nist.gov!klm
- From: klm@cam.nist.gov (Ken Manheimer)
- Newsgroups: gnu.emacs.help
- Subject: Re: Why does completing-read take an ALIST?
- Message-ID: <KLM.93Jan5231551@coil.cam.nist.gov>
- Date: 6 Jan 93 04:15:51 GMT
- References: <1993Jan6.001155.1238@spock.retix.com>
- Sender: news@dove.nist.gov
- Distribution: na
- Organization: Nat'l Institute of Standards and Technology
- Lines: 26
- In-reply-to: dspencer@mproj.retix.com's message of 6 Jan 93 00:11:55 GMT
-
- dspencer@mproj.retix.com (David Spencer) writes:
-
- > I've never understood why the second arg to completing-read, 'TABLE',
- > is an alist. As far as I can tell, the cdr's of each element are
- > not used, so why not just make it a list of strings?
-
- I think i know the, or at least an, answer to this one.
-
- Completing read takes a vector of symbols as well as an alist. The
- vector serves as the flat table format, handy for those times when
- you're dealing with, eg, the elisp obarray. Given a match in the
- obarray, you obtain an associated value via a suitable symbol lookup
- function (eg, symbol-{value,function}), or whatever custom relation
- you prefer.
-
- Alists are suited to those purposes where the value is encoded in the
- table. You get the value once you have the key via the assoc and assq
- functions...
-
- I've been messing with the completion functions, extending intrinsic
- minibuffer completion for incremental, in-the-minibuffer candidate
- displays. The seemingly arbitrary completion functions wind up
- covering all the bases pretty nicely.
-
- Ken
- klm@nist.gov, 301 975-3539
-