Clojure

array-map fails lazily if passed an odd number of arguments

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test

Description

If called with an odd number of arguments, array-map does not throw an exception until the map is realized, when it throws the confusing ArrayIndexOutOfBoundsException.

Example, in 1.5.1 and 1.6.0-alpha3:

user=> (def m (array-map :a 1 :b))
#'user/m

user=> (prn m)
ArrayIndexOutOfBoundsException 3
  clojure.lang.PersistentArrayMap$Seq.first
  (PersistentArrayMap.java:313)

Activity

Jason Felice made changes -
Field Original Value New Value
Attachment 0001-CLJ-1319-Throw-on-odd-arguments-to-PersistentArrayMa.patch [ 12724 ]
Andy Fingerhut made changes -
Patch Code and Test [ 10002 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: