Clojure

Extend CollFold and IKVReduce to nil

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.5
  • Component/s: None
  • Labels:
    None
  • 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

Activity

Hide
Herwig Hochleitner added a comment -

Attached patch with tests

Show
Herwig Hochleitner added a comment - Attached patch with tests
Herwig Hochleitner made changes -
Field Original Value New Value
Attachment 0001-CLJ-1098-Implement-IKVReduce-and-CollFold-for-nil.patch [ 11648 ]
Herwig Hochleitner made changes -
Patch Code and Test [ 10002 ]
Hide
Andy Fingerhut added a comment -
Show
Andy Fingerhut added a comment - Another discussion thread: https://groups.google.com/forum/?fromgroups=#!topic/clojure/xPDDybYGvmc
Rich Hickey made changes -
Resolution Completed [ 1 ]
Fix Version/s Release 1.5 [ 10150 ]
Approval Ok [ 10007 ]
Status Open [ 1 ] Resolved [ 5 ]
Stuart Halloway made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (3)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: