Fork me on GitHub
#clojure-dev
<
2018-09-17
>
andy.fingerhut21:09:00

A few days ago in the #clojure channel someone said: "i've just realized (= '(1 2 3) [1 2 3]) => true" if for some reason i don't want this behavior, what can I do?"

andy.fingerhut21:09:22

Alex Miller responded "The reasons for this are subtle and important and in many ways essential for Clojure to be what it is"

andy.fingerhut21:09:15

I've written an article once where I explained only briefly the reasons for this behavior as follows: "it was considered useful and convenient". That might be leaving out much better arguments, and I was curious if anyone had any in mind, and/or articles that go into that decision in more depth.

andy.fingerhut22:09:46

It is useful and convenient in many ways. I can also think of cases where it makes programs more efficient, because you do not need to convert between different sequence types before comparing them using an imagined strict-= that only returned true if the sequential things being compared had the same type.

alexmiller22:09:03

The main thing is that we frequently switch sequential types, most obviously from concrete colls like lists and vectors to seqs, but other cases too

alexmiller22:09:52

Blurring those lines is really important to make working with seq functions low friction

alexmiller22:09:47

Whenever possible I try to write code that is agnostic to the type of the sequential coll

alexmiller22:09:52

Auto seq on seq function inputs is in same ballpark