I feel like I’ve missed the boat here, but I keep finding that I have to continue to use Long/parseLong because parse-long doesn’t have the option of a radix. Was that a decision, or just not noticed? (Admittedly, I’m doing more numerical work than many people)
Is it just one radix you use a lot, or several?
Mostly 16. Occasionally 2
If you need that, use interop
I do (and I also use interop in ClojureScript). But I used interop for parsing longs in the first place, and now there's a wrapper for it. So I wondered about why one mode was wrapped but not the other.
I can keep using #?, but I’m interested in every opportunity to remove conditional compilation. parse-long is part of the way there, which is why I asked
Not trying to hit every use
Fwiw, I've also hit this a few times.
is there a way to use into or transduce without having array-maps converted hash-maps?
(into (array-map) (map vec) (partition 2 (range 20)))
=> {0 1, 4 5, 6 7, 12 13, 2 3, 14 15, 16 17, 10 11, 18 19, 8 9}
(type (into (array-map) (map vec) (partition 2 (range 20))))
=> clojure.lang.PersistentHashMapThe only way I know to end up with an array-map with more than 8 keys in it is to call a constructor that always returns an array-map, and then don't do any other operations on that result.
why
if the why refers to my initial question, it’s to preserve order while being able to look up values by association
The lookup time is O(n) for array-maps, not sure if that is an issue for you.
There is also this Clojure data structure, which maintains insertion order but has lookup just as fast as Clojure's maps, because under the hood it is just a Clojure (unordered) map with hashing, plus a vector that remembers the key insertion order: https://github.com/clj-commons/ordered