Clojure

clojure.core/vals returns nil on an empty map instead of an empty sequence

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Is this a bug? maybe I just don't understand. The documentation says: Returns a sequence of the map's values. Is nil a sequence?

This caused an unexpected nil to propagate through a bunch of list processing stuff.

Activity

Hide
Alex Miller added a comment -

An empty sequence is represented by nil, so this is consistent. For example: (seq (range 0)) => nil

Show
Alex Miller added a comment - An empty sequence is represented by nil, so this is consistent. For example: (seq (range 0)) => nil

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: