Cool - thanks. I didn't know about that function :-)

2009/11/27 John Harrop <jharrop...@gmail.com>

>  On Thu, Nov 26, 2009 at 4:37 AM, Chris Jenkins <cdpjenk...@gmail.com>wrote:
>>
>>  (defn flip-cell [b x y]
>>   (let [row      (nth b y)
>> cell     (nth row x)
>> new-cell (- 1 cell)
>> new-row  (assoc row x new-cell)]
>>     (assoc b y new-row)))
>>
>
> (defn flip-cell [b x y]
>   (update-in b [y x] #(- 1 %)))
>
> :)
>
> --
>  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<clojure%2bunsubscr...@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 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

Reply via email to