Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

code-char and char-code

23 views
Skip to first unread message

Pierre R. Mai

unread,
Jun 24, 1999, 3:00:00 AM6/24/99
to
Jan Egil Hagen <ja...@nntp.ifi.uio.no> writes:

> I am confused about the behavior of code-char and char-code.
> According to the HyperSpec, (code-char (char-code c)) is supposed to
> return c. But Allegro CL Trial Edition 5.0 behaves like this:

Hmmm, not having verified this in the CLHS, I'd think that it only
states that the result of (code-char (char-code c)) is supposed to
return something eql to c, and not necessarily c itself (see 13.1.5,
where it states that two characters being eql don't have to be eq,
i.e. identical objects).

> (code-char (char-code #\newline))
> => #\newline
> (code-char (char-code #\ø))
> => #\%x

But also:

(eql #\ø #\%x)
=> T

So ACL is not in violation of the Spec, wrt. to code-char and char-code.
It just seems to me that with default settings the ACL printer chooses a
7bit representation of 8bit characters for printing, where #\%x and #\ø
denote the same character. But to be certain about that, I'd consult
the documentation of ACL, where I would expect to find information about
this.

Regs, Pierre.

--
Pierre Mai <pm...@acm.org> PGP and GPG keys at your nearest Keyserver
"One smaller motivation which, in part, stems from altruism is Microsoft-
bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]

Erik Naggum

unread,
Jun 24, 1999, 3:00:00 AM6/24/99
to
* Jan Egil Hagen <ja...@nntp.ifi.uio.no>

| I am confused about the behavior of code-char and char-code.

no, you're confused about the print syntax of characters.

| Allegro CL Trial Edition 5.0 behaves like this:
|

| (code-char (char-code #\newline))
| => #\newline

| (code-char (char-code #\ų))
| => #\%x

how come you didn't type #\ų and see what it printed out, too?

| Why is Allegro doing what it is doing, and how can I make it behave like
| CMUCL?

(fill excl::*char-int-to-name* nil :start 160)

#:Erik
--
@1999-07-22T00:37:33Z -- pi billion seconds since the turn of the century

Stig Hemmer

unread,
Jun 24, 1999, 3:00:00 AM6/24/99
to
Jan Egil Hagen <ja...@nntp.ifi.uio.no> writes:
> (code-char (char-code #\ų))
> => #\%x

Try
#\ų
=> #\%x

(char= #\ų (code-char (char-code #\ų)))
=> T

So, the problem is that ACL and CMUCL disagrees on the print-syntax
for meta-characters.

Now, please tell us why this is a problem for you?

Stig Hemmer,
Jack of a Few Trades.

Steve Gonedes

unread,
Jun 24, 1999, 3:00:00 AM6/24/99
to

Jan Egil Hagen <ja...@nntp.ifi.uio.no> writes:

< I am confused about the behavior of code-char and char-code.

< According to the HyperSpec, (code-char (char-code c)) is supposed to

< return c. But Allegro CL Trial Edition 5.0 behaves like this:


<
< (code-char (char-code #\newline))
< => #\newline

< (code-char (char-code #\ų))
< => #\%x

It will print how you expect when you change the result into a string.

(string (code-char (char-code #\ų))) => "ų"


0 new messages