Created
February 18, 2013 14:57
-
-
Save qerub/4977996 to your computer and use it in GitHub Desktop.
[Clojure] CharSequence adapter for seqables of chars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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