'Why build a Clojure string using literal characters?

I was reading some code just now, and I ran across this line:

(str cache \, \space lru \, \space tick \, \space limit)

This is odd to me. Consecutive literal characters are used, instead of a string containing those characters. I would expect something more like this:

(str cache ", " lru ", " tick ", " limit)

But this is in a core library written by some venerable Clojure veterans, which makes me think that maybe there's a reason. What's the reason? Performance? Or what?



Solution 1:[1]

There is no good reason. It probably performs worse than the version with strings, in addition to being uglier. You could also write (join ", " [cache lru tick limit]), which would be my preference, but I can understand choosing to write it out longhand. Using characters instead of strings is inexplicable, though. I can't track down the commit that added this line, because the repo has been destroyed and rebuilt at least twice as it switched names, but I'd wager there was no good reason. Maybe some misguided performance ideas.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1