Subject: Wish list item: , in integers made readable
From: Erik Naggum <erik@naggum.no>
Date: 2000/05/19
Newsgroups: comp.lang.lisp
Message-ID: <3167733463524161@naggum.no>

  Ada has one good thing about numeric constants: They may contain _
  (underscore) to make them more readable.  Common Lisp can print
  numbers that look even nicer, with a , (comma) grouping digits, but
  it can't read them back in, again.  This annoyed me today, as I was
  gawking at a whole bunch of large integers that had to be readable.
  So I made , non-terminating.

(set-macro-char #\, (get-macro-char #\,) t)

  This meant 123,456,789 read back as the symbol named "123,456,789"
  which is almost exactly half as useful as what I had in mind.  So I
  hacked the function that I thought made the wrong decision about
  numberhood of this string.  The rest of the system was not amused,
  so I had to delete the commas from the input at a fairly low level,
  but that's not too satisfactory, as it's common in some cultures to
  use dot or space, not comma, for grouping (silly Europeans!), and
  parse-integer could really use some more options.  Like a cancer my
  wish list item grew, so here's the condensed and sanitized version
  of with wish list item:

  I'd like integers printed with internal commas for grouping to be
  readable as if the commas were absent.  This requires the comma to
  be a non-terminating macro character, which _could_ cause problems
  with space-deficient legacy code.  It would be nice if more of the
  system would grok human-readable numbers, and I would be positively
  thrilled if write and friends would do grouping, not just format.

  Unfortunately, this requires rather low-level changes to most Common
  Lisp implementations, so I'm asking for reactions and suggestions.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.