Re: code critique
- From: Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx>
- Date: Thu, 31 May 2007 14:17:22 +0200
Richard M Kreuter <kreuter@xxxxxxxxx> writes:
Daniel Leidisch <news@xxxxxxxxxxxx> writes:
In article <87r6oyigvo.fsf@xxxxxxxxxxxxxxxxxx> you wrote:
* A portability caveat: ANSI Common Lisp does not require
characters to be encoded in ASCII or any other encoding, and so
CODE-CHAR may not do what you expect here.
Do you have any suggestions as to how to implement this
more portably?
Well, this was mostly a fussy "technically this isn't portable" note;
all current implementations do, I think, use a superset of ASCII for
their character repertoires.
In case you are interested in being fussy: a conforming ANSI CL
implementation is only required to support the 96 characters in the
standard-character repertoire, and one of those characters, Newline,
need not map to a single ASCII character. You can get the standard
character for an ASCII code like this:
(defun ascii-code-char (code)
(cond ((< 31 code 127)
(char #.(format nil "~@{~A~}"
" !\"#$%&’()*+,-./0123456789:;<=>?@"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`"
"abcdefghijklmnopqrstuvwxyz{|}~")
(- code 32)))
(t ;Here you might handle Newline and the semistandard characters
(error "Can't find an ASCII character for code ~D" code))))
For the other characters in the ASCII character set, you'll need to
resort to implementation-dependent details.
There are NO other character in the ASCII character set.
There are a few control codes in the ASCII codes.
--
__Pascal Bourguignon__ http://www.informatimago.com/
NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
.
- Follow-Ups:
- Re: code critique
- From: Richard M Kreuter
- Re: code critique
- From: Edi Weitz
- Re: code critique
- References:
- code critique
- From: Daniel Leidisch
- Re: code critique
- From: Richard M Kreuter
- Re: code critique
- From: Daniel Leidisch
- Re: code critique
- From: Richard M Kreuter
- code critique
- Prev by Date: Re: Break Statements similar to C or C++
- Next by Date: Re: Continuation based app servers
- Previous by thread: Re: code critique
- Next by thread: Re: code critique
- Index(es):
Relevant Pages
|