Created
August 2, 2012 05:45
-
-
Save ponkore/3234115 to your computer and use it in GitHub Desktop.
mapリテラルでは8対までは array-map、それより多い対は hash-map が生成される。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; @___otabat___ さんのツイート https://twitter.com/___otabat___/status/230890089218195456 | |
;; より引用 | |
;; 「Clojureでmapリテラルを使うとき、8対目まではarray-map、9対目からhash-mapに変わるなどデータと内部実装が異なるのは注意。」 | |
;; を試してみた。 | |
user=> (class {:a 10 :b 20}) | |
;= clojure.lang.PersistentArrayMap | |
user=> (class {:a 10 :b 20 :c 30 :d 40 :e 50 :f 60 :g 70 :h 80}) | |
;= clojure.lang.PersistentArrayMap (:a〜:h 8対まで) | |
user=> (class {:a 10 :b 20 :c 30 :d 40 :e 50 :f 60 :g 70 :h 80 :i 90}) | |
;= clojure.lang.PersistentHashMap (:a〜:i 9対、PersistentHashMap に変わった!!) | |
user=> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment