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
Andy Fingerhut added a comment -
Show
Andy Fingerhut added a comment - Another discussion thread: https://groups.google.com/forum/?fromgroups=#!topic/clojure/xPDDybYGvmc
Hide
Herwig Hochleitner added a comment -

Attached patch with tests

Show
Herwig Hochleitner added a comment - Attached patch with tests

People

Vote (3)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: