clojure-dev 2026-07-22

Is this expected: (nth nil 10) => nil. The docs say that this should throw. And indeed, (nth [] 10) or (nth '() 10) throw. Documented on http://ask.clojure.org here: https://ask.clojure.org/index.php/15195/nth-nil-10-returns-nil-when-it-should-throw

Alex Miller (Clojure team) 2026-07-22T13:53:55.343939Z

Yes, this is expected. nth, like get or contains? has polymorphic behavior on nil. You could think of this as being outside the behavior described in the docstring because there are no bounds on nil.