>> (loop [data (sorted-map)
>>          collection newData
>>          meeting (first collection)]
>>
>>   (def key ( .... ))
>
> As a general rule, def should only be used at the top level. You
> probably want (let [key ...] (if ...) here.

Hey, thanks for pointing this out - I was actually just trying to
avoid passing these values in the loop signature. Your point is very
well taken and I've now replaced those (def)'s with a let inside the
loop.

>
>>   (if (not (nil? (next collection)
>
> Minor nit: (not (nil? X)) is better spelled (seq? X))

Right!


> That's actually a standard idiom, except you missed the assoc-in and
> get-in functions:
>
> (assoc-in data key :meetings (conj (get-in data key :meetings) meeting)

Thanks for the advice. I've taken Laurent's feedback and ended up with:

 (update-in data [week-difference]
                          (fnil update-in (struct week title []))
                          ["meetings"] into [decorated])

Which certainly reads far better than what I had. Thanks for pointing
out get-in, another *key* fn I've missed.

The standard library is rather large, I guess this'll take a while.

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