On Wed, Apr 22, 2009 at 2:38 AM, miki <miki.teb...@gmail.com> wrote:
>
> Is the fact that the output of (show java.math.BigInteger) and (show
> bigint) differ is a bug or a feature? :)

Feature!

The symbol java.math.BigInteger refers to the BigInteger class, and
'show' shows that.  The symbol bigint refers to a function, so 'show'
finds its class (clojure.core$bigint__4128 on my build here) and shows
you the details of that class, which are largely the same as
clojure.lang.AFn.

You might find the 'source' macro to be more useful for inspecting
functions like 'bigint':

user=> (source bigint)
(defn bigint
  "Coerce to BigInteger"
  {:tag BigInteger}
  [x] (cond
       (instance? BigInteger x) x
       (decimal? x) (.toBigInteger #^BigDecimal x)
       (number? x) (BigInteger/valueOf (long x))
       :else (BigInteger. x)))
nil

--Chouser

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to