On Oct 29, 2:20 pm, Paul Drummond
<[EMAIL PROTECTED]> wrote:
> Is there reason why abs is not part of the Numbers interface?
I don't know, but...
> Would be nice to be able to use:
>
> (abs -1.0)
> 1
> (abs 1.0M)
> 1M
How about this:
(defn abs [x]
(if (< x 0) (- x) x))
This does what you requested:
user=> (abs -1.0)
1.0
user=> (abs 1.0M)
1.0M
Konrad.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---