Hi, On Tue, May 18, 2010 at 04:16:01PM -0400, Russell Christopher wrote:
> Although that would return the default for a key with a nil value. So you're > probably right reduce would have to change. > > On Tue, May 18, 2010 at 3:49 PM, Russell Christopher < > russell.christop...@gmail.com> wrote: > > > (defn get-in > > ([m ks] > > (reduce get m ks)) > > ([m ks not-found] > > (if-let [res (get-in m ks)] res not-found))) > > > > Longer but still uses reduce It's always a good idea to use things we already have: (defn get-in ([m ks] (reduce get m ks)) ([m ks not-found] (get (get-in m (butlast ks)) (last ks) not-found))) Sincerely Meikel -- 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