Perhaps some context help. Why would you want to continue popping an empty collection? If you are in a loop, when will you stop popping it? Perhaps there is a more logical idiom to use for the case you run into pop nil exceptions (doseq?)
On Feb 22, 5:18 pm, Frantisek Sodomka <fsodo...@gmail.com> wrote: > Any thoughts on this one? > > Impatient Frantisek :-) > > On 21 Ún, 22:28, Frantisek Sodomka <fsodo...@gmail.com> wrote: > > > > > Hello! > > Currently, 'pop' throws an exception if the collection is empty: > > > clojure.core/pop > > ([coll]) > > For a list or queue, returns a new list/queue without the first > > item, for a vector, returns a new vector without the last item. If > > the collection is empty, throws an exception. Note - not the same > > as next/butlast. > > > user=> (pop ()) > > java.lang.IllegalStateException: Can't pop empty list (NO_SOURCE_FILE: > > 0) > > user=> (pop []) > > java.lang.IllegalStateException: Can't pop empty vector > > (NO_SOURCE_FILE:0) > > > Should (pop nil) also throw an exception or is returning 'nil' ok?? > > user=> (pop nil) > > nil > > > Thank you, Frantisek --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---