Subject: = in ClojureScript differs from Clojure API for arities other
than 2

Using ClojureScript f4c0de502c92ce710da923888d672f22213b902c (checked
out on Thu Jan 19 2012)
=> (= 1)
false  ;; incorrect

=> (= 1 1)
true

=> (= 1 1 2)
true  ;; incorrect

=> (= 1 1 1)
true  ;; correct, but by accident

In Clojure and according to Clojure's API = is defined for all arities
[1,2]
=> (= 1)
true

=> (= 1 1)
true

=> (= 1 1 2)
false

The source of this bug is that = is only implemented in ClojureScript
for the 2 arity [3]. Combined with the javascript behaviour for
superfluous arguments this leads to these unfortunate results.
Implementing = for multi arities in ClojureScript by following the
Clojure implementation should fix this. See for example the <
predicate in ClojureScript [4].

My apologies for not using the bug tracker and not supplying a patch.
I am not yet familiar with those systems.

-Gijs

[1] = API - 
http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/=
[2] = in clj - 
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L719
[3] = in cljs - 
https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L180
[4] < in cljs as an example of a multi-arity predicate -
https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L801

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

Reply via email to