Clojure

Vectors returned by subvec allow access at negative indices

Details

  • Type: Defect Defect
  • 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

Google group thread: https://mail.google.com/mail/?shva=1#label/clojure/1365e058eaf0d5fa

Vectors returned by subvec correctly disallow access to elements after their end, but not before their beginning.

Clojure 1.3.0
user=> (def v1 (vec (range 100)))
#'user/v1
user=> (def v2 (subvec v1 50 52))
#'user/v2
user=> (v2 3)
IndexOutOfBoundsException clojure.lang.APersistentVector$SubVector.nth (APersistentVector.java:526)
user=> (v2 -48)
2

Activity

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: