home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / lisp / 3220 < prev    next >
Encoding:
Internet Message Format  |  1993-01-09  |  2.5 KB

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