On Sat, Jun 2, 2012 at 2:34 PM, Moritz Ulrich
<[email protected]> 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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en