Re: My first clojure web app
On Wed, Jan 5, 2011 at 9:21 PM, Timothy Pratley wrote: > Neat, looks pretty nice. > I love invitations to nit pick! > database.clj > (defn complete-todo [id] > (dosync (ref-set *todo* (vec (remove #(= (get % :id) id) @*todo*) > 1) ref-set is unnecessary you could re-factor this to use alter. The > result is the same, but semantically set only applies when the new > value cannot be calculated from the old. > I thought the update function to alter had to be able to take sequence item so that you could use conj with alter but not cons. and by the same idea, because remove takes the sequence 2nd, it could be used w/ alter. -- 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
Re: My first clojure web app
Neat, looks pretty nice. I love invitations to nit pick! database.clj (defn complete-todo [id] (dosync (ref-set *todo* (vec (remove #(= (get % :id) id) @*todo*) 1) ref-set is unnecessary you could re-factor this to use alter. The result is the same, but semantically set only applies when the new value cannot be calculated from the old. 2) If instead you defined *todo* as a map you could just say (alter *todo* dissoc id)... and your add function would be simpler also. Perhaps you wanted to preserve the order, in which case a sorted-map might be the ticket. Happy Clojuring :) On Sun, Jan 2, 2011 at 9:16 AM, Sean Allen wrote: > I finally moved on from messing around with stuff in the repl and trying to > get a firm grasp on all things clojure and dove into doing a little web > development with it. I hadn't used ring, compojure or enlive before so I > kept that functionality in the app really minimal. I'd appreciate feedback > on: > ways my clojure code could be improved/made more idiomatic. > things i did wrong with ring, compojure and enlive > code organization etc. > Thanks in advance to anyone who takes a look and gives me so feedback. > Code is on github at: https://github.com/SeanTAllen/Simple-Compojure-To-Do > -Sean- > > -- > 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 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
My first clojure web app
I finally moved on from messing around with stuff in the repl and trying to get a firm grasp on all things clojure and dove into doing a little web development with it. I hadn't used ring, compojure or enlive before so I kept that functionality in the app really minimal. I'd appreciate feedback on: ways my clojure code could be improved/made more idiomatic. things i did wrong with ring, compojure and enlive code organization etc. Thanks in advance to anyone who takes a look and gives me so feedback. Code is on github at: https://github.com/SeanTAllen/Simple-Compojure-To-Do -Sean- -- 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