Lines 57--62 of
https://github.com/clojure/math.numeric-tower/blob/master/src/main/clojure/clojure/math/numeric_tower.clj
;; so this code works with both 1.2.x and 1.3.0:
(def ^{:private true} minus (first [-' -]))
(def ^{:private true} mult (first [*' *]))
(def ^{:private true} plus (first [+' +]))
(def ^{:private true} dec* (first [dec' dec]))
(def ^{:private true} inc* (first [inc' inc]))
I was wondering why (first [*' *]) is used instead of just *.
My guess, but I do not know how to verify:
1. IIRC early versions of Clojure defaulted to auto-promotion arithmetic
operators.
2. My guess the default was changed to not permote between 1.2.x and
1.3.0.
3. Total guess, the 1.2.x reader treat the ' at the end of a symbol as
being it's own thing and change to (quote ..)
4. So that in 1.2.x [*' *] would become [* (quote *)], and first would
get *, and * auto promoted in 1.2.x. In 1.3.0 first gets the auto-promotion
version *'.
But that a total guess. Why is this construction used?
--
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.