home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.lang.lisp
- Subject: Re: Improper lists
- Date: 9 Jan 1993 19:41:40 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 42
- Message-ID: <1in9pkINNe50@early-bird.think.com>
- References: <19930108174830.1.WKF@DJINN.SCRC.Symbolics.COM>
- NNTP-Posting-Host: gandalf.think.com
-
- In article <19930108174830.1.WKF@DJINN.SCRC.Symbolics.COM> wkf@stony-brook.scrc.symbolics.com (William K. Foster) writes:
- >This definition does not state whether an empty chain of conses is a
- >list. An empty chain must be a list in order for nil to be a list.
- >However, using the same reasoning, all atoms are lists, nil being a
- >proper list and all other atoms being improper lists.
-
- Given the definitions as they're currently written, you're correct: all
- objects are lists (well, it *is* a "list processing" language :-). I don't
- think this was the original intent, though; I'm looking into getting the
- definition of "dotted list" changed to require at least one cons (and refer
- to this in the definition of "list").
-
- Note also that there are two definitions of "list" in the glossary. The
- second definition is objects of type (OR CONS NULL), and atoms aren't lists
- according to that. The first definition describes the concept of lists,
- while the second one describes the type list. Since the first definition
- is currently useless for discrimination, we may decide that any use of the
- term for descrimination must intend the second definition.
-
- >nth is defined to take a second argument which is a list.
-
- This isn't a problem, even without the above clarifications. The beginning
- of the Conses chapter says:
-
- "Except as explicitly specified otherwise, any \term{standardized}
- \term{function} that takes a \term{parameter} that required to be a
- \term{list} should be prepared to signal an error \oftype{type-error} if
- the \term{value} received is a \term{dotted list}."
-
- A problem with this is that it permits implementations to signal an error
- when the argument is a dotted list, even if it doesn't need to access the
- end of the list; for instance, (NTH '(A . B) 0) could signal an error (the
- "should be prepared to signal" phrase allows an implementation to omit
- checking, but it doesn't prevent checking). Therefore, there's been a
- proposal to change many of these functions to allow dotted list arguments.
- In that case my clarifications would solve the problem of (NTH <atom> N)
- being allowed.
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-