Reputation: 8503
I'm trying to reduce a vec like [\space \space \space \a \space]
to
" a "
However, I'm getting:
Clojure> (apply str [\space \space \space \a])
" a "
It seems str is stripping multiple \space chars. Is there a way to get around this?
(By the way, I'm just using Try Clojure to try and work through 4clojure)
Upvotes: 3
Views: 940
Reputation: 92067
It's not a clojure issue, just an HTML issue: If I write:
a b c
That renders as just a b c because HTML collapses whitespace (feel free to check the source of this question - I really wrote lots of spaces in both instances). Your repl is in an HTML environment, so I wouldn't be too surprised to learn that in one or two places it isn't careful enough about escaping <code>
blocks.
Upvotes: 5
Reputation: 10789
I think its tryclj issue, not clojure. Just tested on clojure 1.2
(apply str [\space \space \space \a]) => " a"
UPD: I'm almost sure that is tryclj markup issue. Just tested on tryclj
(= (apply str [\space \space \a]) " a") => false
(= (apply str [\space \space \a]) " a") => true
Upvotes: 7