File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 698698 ([x y] (clojure.lang.Util/identical x y)))
699699
700700; equiv-based
701- (defn =
701+ #_ (defn =
702702 " Equality. Returns true if x equals y, false if not. Same as
703703 Java x.equals(y) except it also works for nil, and compares
704704 numbers and collections in a type-independent manner. Clojure's immutable data
717717 false )))
718718
719719; equals-based
720- #_(defn =
721- " Equality. Returns true if x equals y, false if not. Same as
722- Java x.equals(y) except it also works for nil, and compares
723- numbers and collections in a type-independent manner. Clojure's immutable data
724- structures define equals() (and thus =) as a value, not an identity,
725- comparison."
720+ (defn =
721+ " Equality. Returns true if x equals y, false if not. Same as Java
722+ x.equals(y) except it also works for nil. Boxed numbers must have
723+ same type. Clojure's immutable data structures define equals() (and
724+ thus =) as a value, not an identity, comparison."
726725 {:inline (fn [x y] `(. clojure.lang.Util equals ~x ~y))
727726 :inline-arities #{2 }
728727 :added " 1.0" }
953952 false )))
954953
955954(defn ==
956- " Returns non-nil if nums all have the same value, otherwise false"
955+ " Returns non-nil if nums all have the equivalent
956+ value (type-independent), otherwise false"
957957 {:inline (fn [x y] `(. clojure.lang.Numbers (equiv ~x ~y)))
958958 :inline-arities #{2 }
959959 :added " 1.0" }
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ static public boolean equals(Object k1, Object k2){
3535 return k1 != null && k1 .equals (k2 );
3636}
3737
38+ //*
3839static public boolean equals (long x , long y ){
3940 return x == y ;
4041}
@@ -44,20 +45,21 @@ static public boolean equals(double x, double y){
4445}
4546
4647static public boolean equals (long x , Object y ){
47- return equals (( Object ) x ,y );
48+ return equals (Numbers . num ( x ) ,y );
4849}
4950
5051static public boolean equals (Object x , long y ){
51- return equals (x ,( Object ) y );
52+ return equals (x ,Numbers . num ( y ) );
5253}
5354
5455static public boolean equals (double x , Object y ){
55- return equals ((Object )x ,y );
56+ return equals ((Double )x ,y );
5657}
5758
5859static public boolean equals (Object x , double y ){
59- return equals (x ,(Object )y );
60+ return equals (x ,(Double )y );
6061}
62+ //*/
6163
6264static public boolean identical (Object k1 , Object k2 ){
6365 return k1 == k2 ;
You can’t perform that action at this time.
0 commit comments