Hi again,

On May 19, 4:14 pm, Meikel Brandmeyer <m...@kotka.de> wrote:

> (defn get-in
>   ([m ks]
>    (get-in m ks nil))
>   ([m ks not-found]
>    (if-let [[k & ks] (seq ks)]
>      (let [candidate (get m k not-found)]
>        (if (identical? candidate not-found)
>          not-found
>          (recur candidate ks not-found)))
>      not-found)))

Oerk. This time hopefully a working version...

(defn get-in
  ([m ks]
   (get-in m ks nil))
  ([m ks not-found]
   (if-let [[k & ks] (seq ks)]
     (let [candidate (get m k not-found)]
       (cond
         (identical? candidate not-found) not-found
         ks                               (recur candidate ks not-
found)
         :else                            candidate))
     (throw (Exception. "Empty key sequence")))))

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

Reply via email to