home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / scheme / 2741 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  1.9 KB

  1. Path: sparky!uunet!spool.mu.edu!caen!uflorida!travis.csd.harris.com!grouper!!brent
  2. From: brent@ssd.csd.harris.com (Brent Benson)
  3. Newsgroups: comp.lang.scheme
  4. Subject: Re: What's the story with ATOM??
  5. Message-ID: <BRENT.92Dec15100927@amber.ssd.csd.harris.com>
  6. Date: 15 Dec 92 15:09:26 GMT
  7. References: <1992Dec15.070322.28439@pasteur.Berkeley.EDU>
  8. Sender: news@grouper.mkt.csd.harris.com (Network News)
  9. Organization: Harris Computer Systems
  10. Lines: 32
  11. In-Reply-To: matt@volga.Berkeley.EDU's message of Tue, 15 Dec 1992 07:03:22 GMT
  12.  
  13. matt@volga.Berkeley.EDU (Matt Wright) writes:
  14.  
  15. > ... The Book says it's just anything that's not a pair...  EdScheme
  16. > thinks '() isn't an atom (contrary to The Book...)
  17.  
  18. This is not contradictory, the empty list is not pair.  The empty list
  19. is both an atom and a list.
  20.  
  21. > What's the story on this?  Do people (e.g., implementors) have
  22. > rationales for doing it a particular way?  To me, (lambda (x) (not
  23. > (pair? x))) makes sense, but on the other hand, it's weird to me
  24. > that a vector is an atom; I'd rather think of a pair as a vector of
  25. > length two than of a vector as an atom.
  26.  
  27. > Do people think this should be in the standard (non-essential, I
  28. > would think)?  Or should I just never use it?
  29.  
  30. In my opinion, the atom/pair distinction is useful when dealing with a
  31. small subset of the Scheme data types (symbols, number and pairs), and
  32. for pedagogical purposes, but not very useful for programming in the
  33. large, primarily because of the presence of a greater variety of types
  34. (characters, vectors, strings, etc.).
  35.  
  36. If you want to now if something is a symbol, use symbol?.  If you want
  37. to now if something is a number or a symbol, use (or (symbol? obj)
  38. (number? obj)).  If you want to now if something is not a pair, use
  39. (not (pair? obj)).  Otherwise, you end up trying to force a square peg
  40. into a round hole.
  41.  
  42. --
  43. Brent Benson                     
  44. Harris Computer Systems
  45.