[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: defining new character names?

From: Lynn Winebarger
Subject: Re: defining new character names?
Date: Wed, 21 Aug 2002 13:27:23 -0500

On Wednesday 21 August 2002 12:33, Keith Wright wrote:
> > From: Lynn Winebarger <address@hidden>
> > 
> > Given the raging debate on this, I'll point out that Chez
> > Scheme has a function char-name that does this job.
> The debate is over a mechanism to define new character names
> (or possibly more general constants).  This appears to be
> a function (or macro?) that fetches an already defined
> character name.  I don't see the relevance.

      It serves multiple purposes.
      As for constants, there's no reason to believe we want
character names to be constant.  There's plenty of reason
to consider forms for setting constants, but this is not one of
them.  Consider

(char-name 'separator #\tab)
         (begin (display (format "~s~s~s" a #\separator b)) (newline))
(char-name 'separator #\space)

Sure it's ugly, but some people like that sort of thing.

> > (char-name 'sym) => #f
> > (char-name #\b) => #f
> Why is that not (char-name #\b) => 'b ?
      Because b is the literal value of the character, not the
symbolic representation.  Of course, you could make it
so any non-numeric representation is considered symbolic,
that's just not how chez defines it.
       Then again, it might be that Dybvig didn't think
(char-name 'b #\a) would be a very useful thing to do,
so prohibited it.

> > (char-name 'paren-close #\051) => unspecified
> Now it's got two arguments instead of one.  WTF!?

     Perhaps you've heard of functions with a variable number
of arguments?

> > (char-name #\paren-close) => 'paren-close
> Am I meant to guess that the preceding function
> (macro?) call with too many arguments was actually
> a definition?

      Yes, and it's a procedure.

> I understand it not at all.  Are you sure those
> examples are correct?
     I just hope it's not a copyright violation, as it's almost
verbatim from the chez user's guide.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]