clojure.tools.trace beats println by far (biased advice, I maintain it....:))) It's also easier to segregate between debug and normal output in the code.
You can enable/disable fn tracing dynamically from the REPL for all fns in a given namespace. I seldom use a debugger. When I do it's to dive in the clojure runtime. The REPL and trace tool meet my needs most of the time. The trick is to avoid having huge chunks of code stuffed in a single fn. It makes life harder. No dumb rule of thumb here (have no more than xx lines per fn, blabla, ...). Just make sure you have testable fns of reasonnable scope. With the trace output, you can then isolate the culprit and test it standalone with its input arguments captured from the trace (cut & paste). Luc P > On Sat, Jun 2, 2012 at 2:34 PM, Moritz Ulrich > <ulrich.mor...@googlemail.com> wrote: > > I think one important point here is that you use two different data > > structures to hold the same kind of data. > > Points and deltas are not the "same kind of data". Yes, they both have > x/y/z values but their meaning is different. Perhaps {:point [x y z]} > and {:delta [x y z]} might be a better choice (combining the vector > approach you suggest while still distinguishing the 'types' that the > OP wants)? > > > If you're using emacs and Slime, there's a full-blown debugger > > integrated in swank-clojure. It features breakpoints, watches, etc. > > True, and it's very powerful. > > > When I encounter such problems, I usually just throw in one or two > > println statements printing the parameters. This way it's easy to > > check if wrong values are passed. > > Perhaps clojure.tools.trace would be easier? > > https://github.com/clojure/tools.trace > > (I keep meaning to switch to using this instead of just adding println > statements!) > > > Adding some asserts is helpful too: In your case it would be wise to > > check at the start of the `add' function if `delta' really has the > > keys #{:dx :dy :dz}. > > Yes, :pre / :post would be another useful technique here! Good suggestion! > -- > Sean A Corfield -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > World Singles, LLC. -- http://worldsingles.com/ > > "Perfection is the enemy of the good." > -- Gustave Flaubert, French realist novelist (1821-1880) > > -- > 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 > -- Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad! -- 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