Guys, Thanks so much for all the answers, thanks for taking the time to give me so many hints even when my email shows my Clojure ignorance.
Cedric, you have a really good point, I just realized it after reading your email. After sending the original email I saw what the error was, but what I still unable to know is how could I debug from Clooj, other than using println, any built-in trace a la LISP? I'm liking Clooj a lot, but really don't know how to debug there. Anyone? Thanks one more Erlis On Thu, Dec 29, 2011 at 9:57 PM, Cedric Greevey <cgree...@gmail.com> wrote: > On Thu, Dec 29, 2011 at 6:23 PM, Mark Engelberg > <mark.engelb...@gmail.com> wrote: > > I'd also like to know whether Clooj has any debug or stacktracing > > capabilities. Also, can the Clooj repl control the print level of > > infinite lazy structures? > > (set! *print-length* 20) > > (set! *print-level* 20) > > (.printStackTrace *e) > > Having shortcut buttons or keys for the latter, at least, would be > useful though. > > As for the original code, there is actually a bug in the function -- > namely, if an argument is nil (or false) it stops there without an > error message and without considering later arguments. Usually for a > loop like that I'd use (if more (let [x (first more)] ...)) in lieu of > if-let. That distinguishes the case more is nil from (first more) is > nil. The correct termination condition is more is nil, in this case. > The < comparison will then naturally blow up with an NPE or type error > if a nil makes it. > > An unfortunate feature of the original code, but hard to classify as a > bug, is that the < test is never performed, and thus no type error can > be generated, if there's only one argument -- which fact made it > harder for the OP to identify the nature of their conundrum. Harder > enough to end up posting here rather than instantly realizing what had > gone wrong, in fact. An explicit additional test at the fn start, such > as (if-not (instance? Number x) (throw ...)) would ensure an exception > throw if the only argument was nonnumeric. Or you could use a > precondition, which is exactly the tool for the job here. > > -- > 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 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