home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!yeh
- From: yeh@cs.purdue.EDU (Wei Jen Yeh)
- Newsgroups: comp.lang.lisp
- Subject: portable O(1) strlen
- Keywords: strlen, format, AKCL
- Message-ID: <19247@ector.cs.purdue.edu>
- Date: 13 Aug 92 07:23:45 GMT
- Sender: news@cs.purdue.EDU
- Organization: Department of Computer Science, Purdue University
- Lines: 19
-
- Hello,
- I just found a bug in my program caused by thinking that
- (array-dimension (format NIL "1234") 0) = 4.
- Strange thing is that the answer is correct if I call string-downcase
- on the value that format returns. I can understand why they behave so.
- But are there some related rules on this matter? I checked Cltl I, but could
- not find discussions on strlen in the string section. A quick solution that
- I'm using now is to (1) scan the array, (2) coerce it to list then call
- length, or (3) write a C function. Solution (1) doesn't seem safe, since
- I cannot be sure that the strings will be padded with some fixed chars.
- (2) is O(n), and (3) is not portable.
-
- So, is there a portable O(1) STRLEN?
-
- Thanks.
- Wei Jen Yeh yeh@cs.purdue.edu
- Department of Computer Science
- Purdue University
- West Lafayette, Indiana
-