Skip to content

Instantly share code, notes, and snippets.

@qerub
Created February 18, 2013 14:57
Show Gist options
  • Save qerub/4977996 to your computer and use it in GitHub Desktop.
Save qerub/4977996 to your computer and use it in GitHub Desktop.
[Clojure] CharSequence adapter for seqables of chars
(defn char-sequence [char-seqable]
(let [char-seq (seq char-seqable)]
(reify CharSequence
(charAt [this i] (nth char-seq i))
(length [this] (count char-seq))
(toString [this] (String. (char-array char-seq)))
; (subSequence [this start end] ...)
)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment