Implementing ISeq

62 views
Skip to first unread message

eyeris

unread,
Jul 26, 2009, 4:45:45 PM7/26/09
to Clojure
I want to implement ISeq to provide a sequence over an Excel file. I
plan to implement it in Java. I see that Range extends ASeq for its
default implementation of cons() and more(). Is extending ASeq the
recommended way to implement a sequence?

Meikel Brandmeyer

unread,
Jul 26, 2009, 5:14:01 PM7/26/09
to clo...@googlegroups.com
Hi,

Yes. The recommended way to implement
a seq is to extend ASeq and implement first()
and more(). (The other methods are optional,
but it might be interesting to exploit some
structure of your data to provide faster versions.
YMMV)

Sincerely
Meikel

Garth Sheldon-Coulson

unread,
Jul 26, 2009, 9:54:29 PM7/26/09
to clo...@googlegroups.com
When I asked the same question a few weeks ago, Rich Hickey gave this response:

http://groups.google.com/group/clojure/browse_thread/thread/77ba769caef82803/60738209810ec491

Looking at StringSeq, as he suggested, was particularly helpful. I found useful the idea of using an integer counter to represent the current location in the data structure.

Best,
Garth
Reply all
Reply to author
Forward
0 new messages