Oh, and the page of examples for 'for' has more examples of :when and :while that work similarly to doseq, and may be more informative: http://clojuredocs.org/clojure.core/for
On Wed, Feb 25, 2015 at 9:14 AM, Andy Fingerhut <andy.finger...@gmail.com> wrote: > doseq does not have anything precisely like C/Java/Perl/etc.'s 'break' or > 'continue'. The closest thing might be the :while keyword. You can see > some one example of its use near the end of the examples on this page: > http://clojuredocs.org/clojure.core/doseq > > The best way I know to get such behavior is to use Clojure's loop, where > if/when/whatever-conditional-statements-you-wish can used to control > explicitly to do another loop iteration using recur, or not. > > Andy > > On Wed, Feb 25, 2015 at 8:59 AM, Cecil Westerhof <cldwester...@gmail.com> > wrote: > >> At the moment I have the following function: >> (defn do-show-table >> [table] >> (doseq [{:keys [table_name]} (show-tables db-spec)] >> (when (= (lower-case table) (lower-case table_name)) >> (let [format "%-20s %-30s %-5s %-5s %-20s\n"] >> (printf format "Field" "Type" "Null?" "Key" "Default") >> (doseq [{:keys [field type null key default]} >> (jdbc/query db-spec [(str "SHOW COLUMNS FROM " >> table)])] >> (printf format field type null key default)))))) >> >> In this case it is not very important, because the outer sequence will >> not be very big. But I would like to leave the doseq at the moment that the >> when is executed. It will be done 0 or 1 times, so after it is done, there >> is no use in continuing the sequence walk. >> >> The second part is that I would like to do an action if it is done 0 >> times after the doseq. Is this possible? >> >> -- >> Cecil Westerhof >> >> -- >> 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 >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.