On Thu, May 20, 2010 at 2:26 PM, Daniel Werner
wrote:
> On 20 May 2010 11:42, Anders Rune Jensen wrote:
>> The algorithm:
>>
>> (defn change-state [cur-state]
>> (when (> (:value cur-state) 10)
>> (assoc cur-state :message "danger, danger")))
>>
>> How I'd have to write it when using an ag
On 20 May 2010 11:42, Anders Rune Jensen wrote:
> The algorithm:
>
> (defn change-state [cur-state]
> (when (> (:value cur-state) 10)
> (assoc cur-state :message "danger, danger")))
>
> How I'd have to write it when using an agent:
>
> (defn change-state [cur-state]
> (cond (> (:value cur
On Thu, May 20, 2010 at 10:40 AM, Rasmus Svensson wrote:
> 2010/5/10 Anders Rune Jensen
>>
>> [...] But I was a little surprised to find out that by
>> default, if you don't return anything, it will set the value of the
>> agent to nil. [...]
>
> Firstly, all clojure functions always return somet
2010/5/10 Anders Rune Jensen
> [...] But I was a little surprised to find out that by
> default, if you don't return anything, it will set the value of the
> agent to nil. [...]
>
Firstly, all clojure functions always return something. Some forms, such as
'cond' and 'when', return nil as a defau