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 <[email protected]> wrote: > On Feb 18, 8:25 pm, linh <[email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
