Hello Stephen, Couple of comments about code: Instead of not nil? you can use some? since clojure 1.6: user=> (doc some?) ------------------------- clojure.core/some? ([x]) Returns true if x is not nil, false otherwise.
str/split and get by 0 may result in error: user=> (str/split ":" #":") [] user=> ((str/split ":" #":") 0) clojure.core/eval core.clj: 3081 ... user/eval10817 form-init2396972653997124309.clj: 1 ... java.lang.IndexOutOfBoundsException: Better use some-> and first: user=> (doc some->) ------------------------- clojure.core/some-> ([expr & forms]) Macro When expr is not nil, threads it into the first form (via ->), and when that result is not nil, through the next etc like user=> (some-> ":" (str/split #":") first) nil Also It will be helpful to add pre condition or other validation to wrap-browser-caching fn to check if filetypes is a map. Best regards, Eduard On Monday, July 27, 2015 at 5:54:03 AM UTC+3, Stephen Lester wrote: > > Hello everyone, > > I just wrote my first ring middleware (I'm pretty much a newbie to > functional programming and Clojure in general), and I'd appreciate if > someone wants to give me some tips or constructive criticism (and it can > be off-list as well). > > The goal is to enable per-file-type browser caching hints. I had found > some other plugins that either set it to 0 (no-cache) or did it based on > server response code, but none that took into account filetype. I was > inspired by a similar thing Apache can do. > > A big thank you to this community! #clojure on Freenode has been > amazing, and most of the time this list is a very interesting read. > > https://github.com/slester/browser-caching > -- 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.