bindings => [name string]
Repeatedly executes body, with name bound to each character in
string. Does NOT handle Unicode supplementary characters (above
U+FFFF).
(defmacro dochars
"bindings => [name string]
Repeatedly executes body, with name bound to each character in
string. Does NOT handle Unicode supplementary characters (above
U+FFFF)."
[bindings & body]
(assert (vector bindings))
(assert (= 2 (count bindings)))
;; This seems to be the fastest way to iterate over characters.
`(let [^String s# ~(second bindings)]
(dotimes [i# (.length s#)]
(let [~(first bindings) (.charAt s# i#)]
~@body))))
Comments top
No comments for dochars. Log in to add a comment.