Try #2, change the order of arguments to "get" using partial

(defn get-in
 ([m ks]
  (get-in m ks nil))
 ([m ks not-found]
  (letfn [(local-get-in [nf m ks] (get m ks nf))]
           (reduce (partial local-get-in not-found) m ks))))

On Tue, May 18, 2010 at 5:23 PM, Meikel Brandmeyer <m...@kotka.de> wrote:

> Hi,
>
> On Tue, May 18, 2010 at 11:11:48PM +0200, Heinz N. Gies wrote:
>
> > Hmm this is slowish, you walk ks twice that way, i think the if-let
> > way is better, performance wise. Not sure if it really matters but for
> > really nested maps this might make a difference.
>
> If we restrict key "sequences" to vectors we could use pop and peek.
> However, I would expect key sequences to be sufficiently short for
> that to be a non-issue in the wild.
>
> And even if its slow: it is correct in all cases. I prefer slow,
> working programs over fast, broken ones.
>
> 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<clojure%2bunsubscr...@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

Reply via email to