One reason for being slightly "impure" here is for greater java interoperability. Clojure gets much of its equality semantics for collections from java.lang.List and java.lang.Set, which define equality to depend only on collection contents and not on concrete type. By having equality semantics which match up, you can pass a clojure vector, list, or seq to a library expecting a j.l.List.
(it's a little more complicated than this; clojure defines its own equality semantics which broadly matches java collection semantics using the .equiv() method. It differs only in which numeric types it considers equal. The clojure = function calls .equiv if present, and .equals otherwise. But broadly clojure's equality matches java collection equality.) On Apr 9, 2013 12:02 AM, "JvJ" <kfjwhee...@gmail.com> wrote: > This is just an idle curiosity up for discussion, but in Clojure, if (= a > b) is true, then given some function f, it is not necessarily true that (= > (f a) (f b)) > > For instance: > > (defn check-eq > [f a b] > [(= a b) > (= (f a) (f b))]) > > (check-eq #(conj % 1) '(1 2 3) [1 2 3]) > [true false] > > Even though the behaviour of lists and vectors differs under specific > functions, they still count as equal, but this statement "If a = b, then (f > a) = (f b)" seems like it would be some sort of rule or axiom about > functional programming. What's the FP purists' view on this? > > > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.