Thanks a lot! On Monday, March 30, 2015 at 8:11:25 PM UTC+2, Michał Marczyk wrote: > > (defn upd-vec [input-vector ids new-values] > (reduce-kv #(assoc %1 %3 (new-values %2)) input-vector ids)) > > (upd-vec [0 0 0 0 0] [1 3] [1.44 1.45]) > ;= [0 1.44 0 1.45 0] > > > On 30 March 2015 at 20:05, Alexandr <updat...@gmail.com <javascript:>> > wrote: > >> Hello everybody, >> >> How can I update values in the vector given vector of id-s and new values? >> >> For example >> >> (defn upd-vec [input-vector ids new-values] >> .... >> ) >> >> (upd-vec [0 0 0 0 0] [1 3] [1.44 1.45]) >> >> Output: [0 1.44 0 1.45 0] (1st and 3rd elements are replaced) >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> <javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > >
-- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.