home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / lisp / 2208 < prev    next >
Encoding:
Internet Message Format  |  1992-08-12  |  1.1 KB

  1. Path: sparky!uunet!usc!sdd.hp.com!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: portable O(1) strlen
  5. Date: 13 Aug 1992 09:18:05 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 19
  8. Message-ID: <16d9cdINNmde@early-bird.think.com>
  9. References: <19247@ector.cs.purdue.edu>
  10. NNTP-Posting-Host: gandalf.think.com
  11. Keywords: strlen, format, AKCL
  12.  
  13. In article <19247@ector.cs.purdue.edu> yeh@cs.purdue.EDU (Wei Jen Yeh) writes:
  14. >Hello,
  15. >  I just found a bug in my program caused by thinking that
  16. >    (array-dimension (format NIL "1234") 0) = 4.
  17.  
  18. Is FORMAT returning a longer string with a fill pointer?  I thought that
  19. functions that create strings were supposed to return simple strings.  What
  20. Lisp does this?
  21.  
  22. >So, is there a portable O(1) STRLEN?
  23.  
  24. LENGTH is O(1) when the argument is a vector, although the coefficient will
  25. usually be higher than ARRAY-DIMENSION, since it has to check whether the
  26. argument is a vector or list, and whether it has a fill pointer.
  27. -- 
  28. Barry Margolin
  29. System Manager, Thinking Machines Corp.
  30.  
  31. barmar@think.com          {uunet,harvard}!think!barmar
  32.