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

Re: DIGIT-WEIGHT/DIGITP and funny input bases



Actually, I think this all is the wrong division of labor.  I really thing what
we want is DIGITP and INPUT-FIXNUM.  DIGITP simply tells you whether a
character is a digit in the current or supplied base, and INPUT-FIXNUM, takes a
first argument of a SEQUENCE of CHARACTERS, and an optional second argument
like DIGITP.  I can't think of any reason why anybody would want to know the
digit weight of a single digit (other than to implement INPUT-FIXNUM), but of
course you can always ask INPUT-FIXNUM to do the conversion.

On a more general level, would take a sequence of characters and an optional
base.  INPUT-NUMBER would return the number that the sequence of characters
represents, or () if it is not a valid number representation.  INPUT-NUMBER
would handle any valid LISP representation for FLONUM's, FIXNUMs, including
such funny things as 1_5 and such if they're still in the language, ROMAN if
your LISP has ROMAN, CHINEESE if you've got that.

A parser would collect digits and pass them off to INPUT-FIXNUM when it got
them all.  I don't see any reason right off why anybody would really want to
deal with the individual weights of individual characters.  Does anybody have
any examples where you would?