Clojure

assoc should throw exception if missing val for last key

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: Release 1.2, Release 1.3, Release 1.4
  • Fix Version/s: Release 1.5
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

https://groups.google.com/forum/?fromgroups=#!topic/clojure/k2R4OdPUCzg

Suggested by Ambrose Bonnaire-Sergeant:

I think assoc should throw an error when applied with uneven arguments.

Currently, the "missing" value is just replaced with nil.

(assoc {} :a 1 :b)
;=> {:a 1, :b nil}

Activity

Andy Fingerhut made changes -
Field Original Value New Value
Attachment clj-1052-assoc-should-throw-exc-if-missing-val-patch1.txt [ 11458 ]
Andy Fingerhut made changes -
Patch Code and Test [ 10002 ]
Andy Fingerhut made changes -
Attachment clj-1052-assoc-should-throw-exc-if-missing-val-patch2.txt [ 11459 ]
Andy Fingerhut made changes -
Attachment clj-1052-assoc-should-throw-exc-if-missing-val-patch1.txt [ 11458 ]
Stuart Halloway made changes -
Approval Screened [ 10004 ]
Andy Fingerhut made changes -
Andy Fingerhut made changes -
Attachment clj-1052-assoc-should-throw-exc-if-missing-val-patch2.txt [ 11459 ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Fix Version/s Release 1.5 [ 10150 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (8)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: