assoc works fine for that. It takes the index where to put the new value and return the newly created vector:
Clojure> (assoc [1 2 3] 1 5)
[1 5 3]
http://stackoverflow.com/questions/12628286/simple-way-to-replace-nth-element-in-a-vector-in-clojure
assoc works fine for that. It takes the index where to put the new value and return the newly created vector:
Clojure> (assoc [1 2 3] 1 5)
[1 5 3]
| Clojure 프로그램 최적화 (0) | 2012.12.29 |
|---|---|
| (Clojure) Real world Clojure performance tuning tips? (0) | 2012.12.26 |
| (Clojure) Type Hints (0) | 2012.12.25 |
| (Clojure) Redirecting *out* to JFrame, TextArea, etc. (0) | 2012.12.24 |
| (Java) Redirecting System.out and System.err to JTextPane or JTextArea (0) | 2012.12.23 |