eigenhombre / PyClojure

(Parts of) Clojure implemented on top of Python
Other
113 stars 13 forks source link

handle large integers #7

Open eigenhombre opened 12 years ago

eigenhombre commented 12 years ago

pyclojure: pylisp> (* 10000000 10000000000) 100000000000000000 pylisp> (* 10000000 1000000000999999999999999999999990) 10000000009999999999999999999999900000000 is unknown! (exits interpreter)

Clojure: user=> (* 10000000 1000000000999999999999999999999990) 10000000009999999999999999999999900000000 user=>

drewr commented 12 years ago

(Ugh, sorry for the duplicate commit.... :'( Thought I needed to format my issue number differently.)

Not sure if I'm missing an edge case, but it satisfies my smoke tests.

pyclojure> (+ 1 1)
2
pyclojure> (* 9223372036854775808 2)
18446744073709551616L
pyclojure> (* 10000000 1000000000999999999999999999999990)
10000000009999999999999999999999900000000L

Thanks for starting this project!

drewr commented 12 years ago

On second thought, if the Python long format is printed then it should be supported in the reader too. Let me try that.

drewr commented 12 years ago

'L' breaks with Clojure's 'N' convention, but Python longs aren't clojure.lang.BigInts so perhaps a distinction is necessary?