<< Back to previous view

[CLJ-1151] Minor Code Cleanup in core.reducers: use required walk, drop this for coll Created: 21/Jan/13  Updated: 03/Sep/13

Status: Open
Project: Clojure
Component/s: None
Affects Version/s: Release 1.5
Fix Version/s: None

Type: Enhancement Priority: Trivial
Reporter: Stefan Kamphausen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File tiny-reducers-cleanup.diff    
Patch: Code

 Description   

First, core.reducers requires clojure.walk :as walk, but does not use the alias.
Second, the two arity implementation of coll-reduce in function reducer uses 'this', whereas similar implementations in that file use 'coll'. AFAICT it makes no difference to use 'coll' (all tests pass, no change in performance) and it is more in line with the rest of the code.

The two things seem small enough to be put into one cleanup case.



 Comments   
Comment by Jozef Wagner [ 03/Sep/13 6:47 AM ]

your patch is wrong. If you want to replace this with coll, you have to allso call xf on f1.

(clojure.core.protocols/coll-reduce this f1 (f1))

becomes

(clojure.core.protocols/coll-reduce coll (xf f1) (f1))
Comment by Stefan Kamphausen [ 03/Sep/13 2:45 PM ]

Scary, that the test suite did not detect that.

Comment by Andy Fingerhut [ 03/Sep/13 2:59 PM ]

Is it straightforward to add a test that would have detected that?

Comment by Stefan Kamphausen [ 03/Sep/13 4:09 PM ]

I will happily look into that. It may take a few days, before I'll find the time, though.

Generated at Sat Oct 25 23:52:17 CDT 2014 using JIRA 4.4#649-r158309.