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

STRING->INTEGER



[This message failed to get through to MC when it was originally sent.]

This is a hairy problem.  Looking at the agony Common Lisp is going
through trying to provide a general solution to this problem is enough
to convince me not to address it.  It has some routine which parses
numbers, and it takes about ten optional arguments.  What should happen
if there's no number there?  How does one find out at what position the
parse completed?  What if the number is terminated by something other
than end-of-string?  What about decimal points and radix prefixes?  etc.

I don't like installing half-solutions to complicated problems unless it
really seems essential to provide the feature, and in this case it
doesn't.  It seems like there is some problem here but I haven't yet
seen a very satisfactory solution.

There is an internal system routine (STRING->INTEGER string radix)
which may do the conversion you want.  I'm not sure how it addresses
the above problems, and of course its being unreleased means it's
risky to depend on it.  Maybe I can be convinced that it should be
released.

(Note that fixnums are an implementation hack, not really part of the
language, so the manual and I avoid talking about them.)
-------