On 3 Apr 2010, at 10:40, Per Vognsen wrote:

By the way, I wanted to emphasize that I don't think this would be an
ideal use of metadata even if your use case was supported. But the
reason metadata is so tempting is that you want frequencies and
distances to be treatable as numbers and so on. If you wrap them up
like I suggested, you couldn't pass them directly to core arithmetic
functions like + and * but would need to perform manual wrapping and
unwrapping.

Right. But then, frequencies and distances are *not* numbers. That's the whole point of dimensional analysis. If frequencies and distances were numbers, you could add a distance and a frequency. But even if you don't care about dimension checks in arithmetic, if distances were just numbers plus a metadata tag, the sum of two distances would just be a number. I don't see much use in such an overly lightweight dimension system.

BTW, there's a unit library for Clojure that takes care of all that, but at the cost of using generic multimethods for arithmetic that add some overhead. For more details, have a look at this blog post:

        http://onclojure.com/2010/03/23/computing-with-units-and-dimensions/

Konrad.

--
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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to