Maybe this will help:

> (update-in [[] 2 3 4] [0] (constantly 1))
[1 2 3 4]

> (update-in [[] 2 3 4] [2] (constantly 1))
[ [ ] 2 1 4]

> (update-in [[] 2 3 4] [1] (constantly 1))
[ [ ] 1 3 4]

> (update-in [[] 2 3 4] [0 :a] (constantly :b))
java.lang.IllegalArgumentException: Key must be integer

> (update-in [[] 2 3 4] [0 0 :a] (constantly :b))
[ [{:a :b}] 2 3 4]


On Tue, Apr 8, 2014 at 6:22 PM, Ivan Schuetz <ivanschu...@gmail.com> wrote:

> I would use merge to update the record with the map... but I don't know
> how to get it from filter operation. Maybe I should not solve this with
> 1-liner.
>
> Am Mittwoch, 9. April 2014 00:14:09 UTC+2 schrieb Ivan Schuetz:
>
>> Ahh dataprovider/products should be "items". Forgot to "simplify".
>>
>>
>> Am Mittwoch, 9. April 2014 00:12:48 UTC+2 schrieb Ivan Schuetz:
>>>
>>> Hi,
>>>
>>> sorry I don't get it. I just started learning Clojure.
>>>
>>> I did this to remove element with id 1
>>>
>>>      (commute items #(remove (fn [x](= (:id x) id)) %))
>>>
>>> From your statement I understand update-in would work for the update,
>>> but I don't know the syntax. Something like
>>>
>>>     (commute dataprovider/products #(update-in % {:id id}  (->Item ???)
>>> ))
>>>
>>>
>>>
>>>
>>> Am Mittwoch, 9. April 2014 00:01:00 UTC+2 schrieb Gary Trakhman:
>>>>
>>>>
>>>>> But 1. Can't find examples with records, 2. Not sure if I can use it
>>>>> to update a different field than the one I'm using to do the query. In the
>>>>> examples fields seem to be the same.
>>>>>
>>>>>
>>>>>
>>>> Leave off the last path segment and return the full updated record, not
>>>> just the new field's value.
>>>>
>>>  --
> 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.
>

-- 
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.

Reply via email to