Details
-
Type:
Enhancement
-
Status:
Closed
-
Priority:
Trivial
-
Resolution: Completed
-
Affects Version/s: Release 1.2
-
Fix Version/s: Release 1.5
-
Component/s: None
-
Labels:None
-
Environment:Clojure versions 1.2 and above
-
Patch:Code and Test
-
Approval:Ok
Description
What I did:
(defn number-to-string
[& {fmt :format locale :locale :or {locale (Locale/getDefault)}}]
(fn [v]
(String/format locale fmt (to-array [v]))))
(defn double-to-string
[& options]
(apply number-to-string :format "%f" options))
(def us-number (double-to-string :locale Locale/US))
(def legacy-number (double-to-string :format "% 3.2f"))
(us-number 3.14159)
(legacy-number 3.14159)
What I expected:
"3.14159" " 3,14"
What I got:
java.lang.IllegalArgumentException: Duplicate key: :format
Using into or a combination of reduce and assoc instead of hash-map would allow this without breaking things.
If this is a desired modification, I can provide a patch. (CA is filed.)
Build map in destructuring step by step instead of calling hash-map.