practicalli

https://practicalli.github.io/ http://yt.vu/+practicalli (youtube)
2020-11-30T09:33:33.188800Z

I still feel a bit weird about the fact that a String is a collection of chars but you if you have any other type of collection of chars then you have to convert it to a string… and using string/join to do that feels a bit weird. TBH I think I prefer using a function called str to do that conversion because it makes the intent super clear: I want a string here.

practicalli-john 2020-11-30T11:04:40.190400Z

A string type is certainly different from other collections. A string is not considered a sequence in Clojure, however, many clojure.core functions will treat it as a sequence of characters. The clojure.string functions feel natural to me when you want to treat a string as a string and get a string back. I think its can feel natural to reach for apply str as its a very common idiom when using a collection as a number of arguments. I recall that we did some criterium testing on apply str and colojure.string/join , if I remember correctly colojure.string/join is more efficient of the two. Its a good experiment to try with https://github.com/hugoduncan/criterium , as well as comparing reduce expressions with apply expressions.

👍 1