I should have done a comparison to original Clojure first. In Clojure, rand-nth on an empty vector does throw an exception, as Meikel says. As does any use of nth with a bad index and no not-found parameter. So that seems to be a bug.
But, nth on a set never works in Clojure, throwing "java.lang.UnsupportedOperationException: nth not supported on this type: PersistentHashSet". So, the fact that it works at all in Clojurescript seems to be a bug as well. On Aug 15, 1:13 am, "Meikel Brandmeyer (kotarak)" <m...@kotka.de> wrote: > Hi, > > Am Sonntag, 14. August 2011 18:59:57 UTC+2 schrieb Despite: > > > > > In Clojurescript, calling rand-nth on an empty Set results in an > > "Index out of bounds" exception, whereas calling it on an empty Vector > > results in nil. > > Returning nil for vectors is almost certainly a bug as it should throw an > exception according to the docstring of nth. > > Sincerely > Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en