thanks, i thought (assoc map key val) only works for maps, but i
should have read the doc more carefully.

On Feb 18, 9:34 pm, James Reeves <weavejes...@googlemail.com> wrote:
> On Feb 18, 8:25 pm, linh <nguyenlinh.m...@gmail.com> wrote:
>
> > hello,
> > what is the idiomatic way to do the following in clojure?
>
> > # ruby pseudo
> > arr = [3 9 4 5]
> > arr[1] = 7
>
> => (def arr [3 9 4 5])
> #'user/arr
> => (assoc arr 1 7)
> [3 7 4 5]
>
> Note that because Clojure data structures are immutable, assoc only
> returns the changed value; it doesn't update arr.
>
> - James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to