[CLJ-1098] Extend CollFold and IKVReduce to nil Created: 31/Oct/12 Updated: 01/Mar/13 Resolved: 25/Jan/13 |
|
| Status: | Closed |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Release 1.5 |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Herwig Hochleitner | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 3 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Ok |
| Description |
|
Currently, reduce-kv and fold throw when used on nil, because their respective protocols don't extend to nil. This seems strange, since Clojure tends to handle nils gracefully where possible, especially in places where collections are expected. See thread https://groups.google.com/d/topic/clojure/tGI8sIKQoh0/discussion |
| Comments |
| Comment by Herwig Hochleitner [ 31/Oct/12 8:44 PM ] |
|
Attached patch with tests |
| Comment by Andy Fingerhut [ 14/Jan/13 11:04 AM ] |
|
Another discussion thread: https://groups.google.com/forum/?fromgroups=#!topic/clojure/xPDDybYGvmc |