The clojure docs say numbers are "generally represented as per Java" with some additions (ratio, variable radix, M and N suffixes, etc.)
For reference, the integer literals for Java are documented here: http://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.10.1 There are some items from the Java spec for numeric literals that are apparently not supported by the Clojure reader - underscores, 0b prefix for binaries, the L, D and F type suffixes, hex formatted decimals, etc. -Aaron On Wed, Apr 27, 2016 at 06:17:28AM -0700, Frank Pursel wrote: > I was acting with respect to what is said here: > http://clojure.org/reference/reader. > > > > On Tuesday, April 26, 2016 at 10:19:59 PM UTC-7, Erik Assum wrote: > > > > In addition to what Andy said, this same behavior was recently implemented > > in tools.reader (the Clojure impel of lisp reader) > > http://dev.clojure.org/jira/browse/TRDR-36 > > > > Erik. > > -- > > i farta > > > > Den 27. apr. 2016 kl. 07.13 skrev Andy Fingerhut <[email protected] > > <javascript:>>: > > > > Frank: > > > > I am pretty sure that the intent is that strings like 077 are read as > > octal, and in Clojure 1.8.0 this is what happens, e.g. (read-string "077") > > evaluates to the integer 63 (decimal), not 77. Thus it is intentional that > > (read-string "08") and (read-string "09") throw exceptions. > > > > Andy > > > > On Tue, Apr 26, 2016 at 8:51 PM, Frank Pursel <[email protected] > > <javascript:>> wrote: > > > >> I believe the following line should replace the current 1.8.0 > >> jvm/clojure/lang/LispReader.java line 68: > >> > >> static Pattern intPat = > >> Pattern.compile( > >> > >> "([-+]?)(?:(0)|(0*[1-9][0-9]*)|0[xX]([0-9A-Fa-f]+)|([0-7]{3})|([1-9][0-9]?)[rR]([0-9A-Za-z]+)|0[0-9]+)(N)?"); > >> > >> > >> Without this change the 1.8.0 clojure reader fails on some simple things > >> like: > >> > >> (read-string "08") > >> (read-string "09") > >> > >> I see that the prior commit was trying to get old style octal identifiers > >> to work (and this change doesn't get this right either) but octal can > >> still > >> be correctly read using the radix notation, eg (read-string "8r45") works. > >> > >> Perhaps someone here can get this change or a more sophisticated fix > >> committed that will allow numeric strings with leading zeros to be > >> successfully read. > >> > >> Regards, > >> Frank Pursel > >> > >> -- > >> You received this message because you are subscribed to the Google > >> Groups "Clojure" group. > >> To post to this group, send email to [email protected] > >> <javascript:> > >> Note that posts from new members are moderated - please be patient with > >> your first post. > >> To unsubscribe from this group, send email to > >> [email protected] <javascript:> > >> For more options, visit this group at > >> http://groups.google.com/group/clojure?hl=en > >> --- > >> You received this message because you are subscribed to the Google Groups > >> "Clojure" group. > >> To unsubscribe from this group and stop receiving emails from it, send an > >> email to [email protected] <javascript:>. > >> For more options, visit https://groups.google.com/d/optout. > >> > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to [email protected] <javascript:> > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > [email protected] <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > --- > > You received this message because you are subscribed to the Google Groups > > "Clojure" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to [email protected] <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > > > > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
