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
>
>
>
> On Tue, May 18, 2010 at 12:20 PM, Stefan Kamphausen <
> ska2...@googlemail.com> wrote:
>
>> Hi,
>>
>> On May 17, 9:34 pm, braver <delivera...@gmail.com> wrote:
>> > If get-in is to be consistent with get, it better allow to specify a
>> > default value:
>> >
>> > (get-in nested-structure [k1 k2 ... kN] :default something)
>> >
>> > -- would it make sense to add that to the standard get-in?
>>
>> while I certainly agree from the users point of view, as an
>> implementer, I'd hate to break the very nice implementation of get-
>> in.  One would have to change reduce first. ;-)
>>
>> Cheers,
>> stefan
>>
>> --
>> 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