More about rationals

While attempting to implement support for rationals yesterday, I stumbled on what is (or at least, seems to me to be) a bug in the Clojure compiler itself. That is, one can not refer to the function / in namespaces other than clojure.core. Now, this is probably the first time that anyone has wanted to do this, so it's not surprising that no one had seen the bug before. But what was surprising to me was that I could fix it fairly easily. I submitted my patch, and I should be a real-life contributor to Clojure pretty soon. As a person who doesn't see himself as a compiler guy, that's pretty exciting.

The next problem that I'm having is that redefining the basic arithmetic operations does not seem to work properly in Clojurescript. The compiled javascript is trying (at least as far as I can tell) to redefine cljs.core/+ rather than rationals/+, for example. This is the problem that I am going to try to solve today.

blog comments powered by Disqus