Re: format and printf can't be used with BigInt

2011-07-29 Thread Ken Wesson
On Fri, Jul 29, 2011 at 1:52 AM, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: Hi, Am Freitag, 29. Juli 2011 01:28:27 UTC+2 schrieb Sean Corfield: Kinda hard since that expression is not valid in 1.3 anyway: ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow

Re: format and printf can't be used with BigInt

2011-07-29 Thread Meikel Brandmeyer (kotarak)
Hi, Am Freitag, 29. Juli 2011 08:24:54 UTC+2 schrieb Ken Wesson: Er, fast would be for primitive integer arithmetic to wrap rather than throw an exception or auto-promote. Both of the latter behaviors require every math op to be accompanied by a test of some sort and a branch (to either the

Re: format and printf can't be used with BigInt

2011-07-29 Thread Ken Wesson
On Fri, Jul 29, 2011 at 2:36 AM, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: Hi, Am Freitag, 29. Juli 2011 08:24:54 UTC+2 schrieb Ken Wesson: Er, fast would be for primitive integer arithmetic to wrap rather than throw an exception or auto-promote. Both of the latter behaviors require

Re: format and printf can't be used with BigInt

2011-07-29 Thread Sean Corfield
On Thu, Jul 28, 2011 at 10:52 PM, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: I think this is one of the misunderstandings or points of disagreements (or whatever you want to name it) in this whole discussion: this code is *not* broken. Code that runs on 1.2 but throws an exception on 1.3

Re: format and printf can't be used with BigInt

2011-07-28 Thread Tom Faulhaber
FWIW, clojure.pprint.cl-format handles this fine in 1.3: (cl-format nil ~d 2N) = 2 On Jul 27, 11:45 am, Andrea Tortorella elian...@gmail.com wrote: Hi everyone, I don't know where to post about bugs (if this is a bug). Anyway in clojure 1.3 with the new numerics: (format %d 2N) throws

Re: format and printf can't be used with BigInt

2011-07-28 Thread Sean Corfield
On Wed, Jul 27, 2011 at 5:56 PM, Ken Wesson kwess...@gmail.com wrote: In Clojure 1.2: (type (bigint 2)) = java.math.BigInteger In Clojure 1.3: (type (bigint 2)) = clojure.lang.BigInt (type 2N) = clojure.lang.BigInt What the devil? Why was this done? Seems like wheel reinvention to me.

Re: format and printf can't be used with BigInt

2011-07-28 Thread Sean Corfield
On Wed, Jul 27, 2011 at 11:48 PM, Tom Faulhaber tomfaulha...@gmail.com wrote: FWIW, clojure.pprint.cl-format handles this fine in 1.3: (cl-format nil ~d 2N) = 2 Wow, I just spent the last 30 minutes reading Common Lisp the Language, 2nd Ed, chapter 22 which describes how powerful and

Re: format and printf can't be used with BigInt

2011-07-28 Thread Andrea Tortorella
Thanks for your replies, +1 for enhancing format Maybe it could handle also rationals, converting them to doubles, but it could be to much. On Jul 28, 9:47 am, Sean Corfield seancorfi...@gmail.com wrote: On Wed, Jul 27, 2011 at 11:48 PM, Tom Faulhaber tomfaulha...@gmail.com wrote: FWIW,

Re: format and printf can't be used with BigInt

2011-07-28 Thread Andrea Tortorella
As I said tweaking `format` to work on rationals could be too much, and i can restate that as it is too much. Nevertheless, extending it to work on bigint doesn't seem to me really an edge case, given that i could get a bigint out of any function that uses autopromotion, so: (printf %d

Re: format and printf can't be used with BigInt

2011-07-28 Thread Stuart Halloway
What the devil? Why was this done? Seems like wheel reinvention to me. Understanding the motivation for such a decision requires taking the time to understand the limitations of what Java provides. Java provides no wheel here -- BigInteger's hash is broken. The draft docs are here:

Re: format and printf can't be used with BigInt

2011-07-28 Thread Perry James
Hi, Is there any way to get to those docs? First I had to crate a user account, then I was told that You cannot view this page Page level restrictions have been applied that limit access to this page. Thanks, Perry == This must be Thursday. I never could get the hang of Thursdays --

Re: format and printf can't be used with BigInt

2011-07-28 Thread Ken Wesson
On Thu, Jul 28, 2011 at 3:05 AM, Sean Corfield seancorfi...@gmail.com wrote: On Wed, Jul 27, 2011 at 5:56 PM, Ken Wesson kwess...@gmail.com wrote: In Clojure 1.2: (type (bigint 2)) = java.math.BigInteger In Clojure 1.3: (type (bigint 2)) = clojure.lang.BigInt (type 2N) =

Re: format and printf can't be used with BigInt

2011-07-28 Thread Sean Corfield
On Thu, Jul 28, 2011 at 1:53 PM, Ken Wesson kwess...@gmail.com wrote: Chas has already pointed you at the rationale / discussion but I'm a Discussions about primitive arithmetic, not BigInteger arithmetic. I take it you didn't actually bother to read the page he linked to? Let me quote the

Re: format and printf can't be used with BigInt

2011-07-28 Thread Sean Corfield
I think one of the authors / core members needs to change the permissions. I have edit access on the parent page http://dev.clojure.org/display/doc/Enhanced+Primitive+Support and the sibling page http://dev.clojure.org/display/doc/Bit+Operations but, like you, don't have view access to the

Re: format and printf can't be used with BigInt

2011-07-28 Thread Ken Wesson
On Thu, Jul 28, 2011 at 7:28 PM, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Jul 28, 2011 at 1:53 PM, Ken Wesson kwess...@gmail.com wrote: Chas has already pointed you at the rationale / discussion but I'm a Discussions about primitive arithmetic, not BigInteger arithmetic. I take it

Re: format and printf can't be used with BigInt

2011-07-28 Thread pmbauer
That wasn't called for. Given Stu linked to the page (and is linked in the 1.3 release notes), it's reasonable to assume the permission error is merely a mistake and not some nefarious plot to withhold information from the Clojure community. On Thursday, July 28, 2011 4:48:34 PM UTC-7, Ken

Re: format and printf can't be used with BigInt

2011-07-28 Thread Ken Wesson
On Thu, Jul 28, 2011 at 9:03 PM, pmbauer paul.michael.ba...@gmail.com wrote: That wasn't called for. ?? Given Stu linked to the page (and is linked in the 1.3 release notes), it's reasonable to assume the permission error is merely a mistake and not some nefarious plot to withhold 

Re: format and printf can't be used with BigInt

2011-07-28 Thread Stuart Halloway
I can't think of a single good reason why any of these pages should not be world-readable. We're an open source project. It's not as if we have trade secrets or something. I have no problem, of course, with restricting *edit* privileges to those with accounts that have proven to be

Re: format and printf can't be used with BigInt

2011-07-28 Thread Meikel Brandmeyer (kotarak)
Hi, Am Freitag, 29. Juli 2011 01:28:27 UTC+2 schrieb Sean Corfield: Kinda hard since that expression is not valid in 1.3 anyway: ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1374) So that code breaks explicitly in 1.3 and in many ways (format)

format and printf can't be used with BigInt

2011-07-27 Thread Andrea Tortorella
Hi everyone, I don't know where to post about bugs (if this is a bug). Anyway in clojure 1.3 with the new numerics: (format %d 2N) throws IllegalFormatConversionException, is it a bug? are there any workarounds? -- You received this message because you are subscribed to the Google Groups

Re: format and printf can't be used with BigInt

2011-07-27 Thread Alan Malloy
On Jul 27, 11:45 am, Andrea Tortorella elian...@gmail.com wrote: Hi everyone, I don't know where to post about bugs (if this is a bug). Anyway in clojure 1.3 with the new numerics: (format %d 2N) throws IllegalFormatConversionException, is it a bug? are there any workarounds? Unlikely to

Re: format and printf can't be used with BigInt

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 4:33 PM, Alan Malloy a...@malloys.org wrote: On Jul 27, 11:45 am, Andrea Tortorella elian...@gmail.com wrote: Hi everyone, I don't know where to post about bugs (if this is a bug). Anyway in clojure 1.3 with the new numerics: (format %d 2N) throws

Re: format and printf can't be used with BigInt

2011-07-27 Thread Sean Corfield
On Wed, Jul 27, 2011 at 4:32 PM, Ken Wesson kwess...@gmail.com wrote: = (.format (java.util.Formatter.) %d (into-array Object [(bigint 2)])) #Formatter 2 (2N isn't recognized as a BigInteger literal by Clojure 1.2, it seems.) In my copy of Clojure 1.2, format also seems to work: = (format

Re: format and printf can't be used with BigInt

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 8:25 PM, Sean Corfield seancorfi...@gmail.com wrote: On Wed, Jul 27, 2011 at 4:32 PM, Ken Wesson kwess...@gmail.com wrote: = (.format (java.util.Formatter.) %d (into-array Object [(bigint 2)])) #Formatter 2 (2N isn't recognized as a BigInteger literal by Clojure 1.2,

Re: format and printf can't be used with BigInt

2011-07-27 Thread Chas Emerick
On Jul 27, 2011, at 8:56 PM, Ken Wesson wrote: In Clojure 1.2: (type (bigint 2)) = java.math.BigInteger In Clojure 1.3: (type (bigint 2)) = clojure.lang.BigInt (type 2N) = clojure.lang.BigInt What the devil? Why was this done? Seems like wheel reinvention to me. See