Hi John,
Thanks for your detailed explanation of the inner workings of my code! I
have been confused by the behavior of Clojure's mutable data structures
quite often, but after reading your explanation it finally starts to make
sense.
I also tried to explain why your code works:
Everything
On Thu, Jan 20, 2011 at 3:34 AM, Stefan Rohlfing
wrote:
> Hi John,
> Thank you very much for your correction of my code! my-merge-with is working
> perfectly now.
> There is just one thing: I always want to understand my errors so that I can
> learn from them. However, I still don't understand why
Hi John,
Thank you very much for your correction of my code! *my-merge-with* is
working perfectly now.
There is just one thing: I always want to understand my errors so that I can
learn from them. However, I still don't understand why my implementation did
not work. Looking at my code I am thi
On Wed, Jan 19, 2011 at 11:23 PM, Stefan Rohlfing
wrote:
> Hi all,
>
> I tried another implementation of 'merge-with' using nested calls to
> 'reduce'. However,
> I just cannot get it to work correctly:
>
> (defn my-merge-with [f & maps]
> (when (some identity
> maps)
> (reduce
> (fn [acc
Hi all,
I tried another implementation of 'merge-with' using nested calls to
'reduce'. However,
I just cannot get it to work correctly:
(defn my-merge-with [f & maps]
(when (some identity
maps)
(reduce
(fn [acc m]
(reduce
(fn [_ [key val]]
(assoc acc key (if-le
On 26 November 2010 16:48, Laurent PETIT wrote:
> 2010/11/26 Steven E. Harris
>> Daniel Werner writes:
>> > (some identity maps), on the other hand, checks whether there is any
>> > non-empty map *in the coll of maps*.
>>
>> By "non-empty" here, do you really mean non-nil? I don't see how the
>>
2010/11/26 Steven E. Harris
> Daniel Werner writes:
>
> > (some identity maps), on the other hand, checks whether there is any
> > non-empty map *in the coll of maps*.
>
> By "non-empty" here, do you really mean non-nil? I don't see how the
> identity function would tell you whether any of the m
Daniel Werner writes:
> (some identity maps), on the other hand, checks whether there is any
> non-empty map *in the coll of maps*.
By "non-empty" here, do you really mean non-nil? I don't see how the
identity function would tell you whether any of the maps are empty or
not.
--
Steven E. Harri
On Nov 26, 1:42 pm, Stefan Rohlfing wrote:
> Question 1:
> (when (some identity maps)
>
> This expression from the original implementation checks if the
> provided coll is empty.
> However, why not just use (when (empty? maps) or (when (seq maps)
> instead?
Note also that (seq maps) and (empty? m
Hi Chris,
Thanks a lot for your clear explanations! Now all the pieces suddenly
make sense to me.
Stefan
On Nov 26, 9:30 pm, Chris Perkins wrote:
> On Nov 26, 7:42 am, Stefan Rohlfing wrote:
>
>
>
>
>
>
>
>
>
> > Dear Clojure Group,
>
> > Today I took a closer look at the 'merge-with' function
On Nov 26, 7:42 am, Stefan Rohlfing wrote:
> Dear Clojure Group,
>
> Today I took a closer look at the 'merge-with' function of Clojure
> Core and changed some parts to better understand its implementation.
>
> Now I still have two questions regarding the following code:
>
> (defn my-merge-with [f
Dear Clojure Group,
Today I took a closer look at the 'merge-with' function of Clojure
Core and changed some parts to better understand its implementation.
Now I still have two questions regarding the following code:
(defn my-merge-with [f & maps]
(when (some identity
maps)
12 matches
Mail list logo