Created
April 17, 2014 14:49
-
-
Save kurogelee/10989191 to your computer and use it in GitHub Desktop.
Clojureでtransientをmutableなオブジェクトとして扱ってはいけない ref: http://qiita.com/kurogelee/items/56694bbce1e374145e5a
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
(let [v (transient {})] | |
(dotimes [n 5] (assoc! v (keyword (str n)) n)) | |
(persistent! v)) |
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
(let [v (transient {})] | |
(dotimes [n 5] (assoc! v (keyword (str n)) n)) | |
(persistent! v)) |
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
{:0 0, :1 1, :2 2, :3 3, :4 4} |
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
(let [v (transient {})] | |
(dotimes [n 10] (assoc! v (keyword (str n)) n)) | |
(persistent! v)) |
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
(let [v (transient {})] | |
(dotimes [n 10] (assoc! v (keyword (str n)) n)) | |
(persistent! v)) |
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
{:0 0, :1 1, :2 2, :3 3, :4 4, :5 5, :6 6, :7 7} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment