# Sequence 0.1.0 Released

**URL:** <https://www.ruby-forum.com/t/sequence-0-1-0-released/71341>\
**Category:** Ruby\
**Created:** [October 7, 2006, 7:39am UTC](https://www.ruby-forum.com/t/sequence-0-1-0-released/71341 "2006-10-07T07:39:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pandemic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pandemic](https://www.ruby-forum.com/u/pandemic)\
**Post date:** [October 7, 2006, 7:39am UTC](https://www.ruby-forum.com/t/sequence-0-1-0-released/71341/1 "2006-10-07T07:39:41Z")

</div>

Sequence version 0.1.0 has been released!

[http://rubyforge.org/projects/sequence](http://rubyforge.org/projects/sequence)  
[http://sequence.rubyforge.org/](http://sequence.rubyforge.org/)

Sequence is a wrapper api for accessing data in Strings, Arrays,  
Files, IOs, and Enumerations. Each sequence encapsulates some  
data and a current position within it. There are methods for  
moving the position, reading and writing data(with or without  
moving the position) forward or backward from the current  
position (or anywhere at all), scanning for patterns (like  
StringScanner, but it works in Files too, among others), and  
saving a position that will remain valid even after data is  
deleted or inserted elsewhere within the sequence.

There are also some utility classes for making sequences reversed  
or circular, turning one-way sequences into two-way, buffering,  
and making sequences that are subsets or aggregations of existing  
sequences.

Sequence is based on Eric M.'s Cursor library. I’d like to  
thank Eric for Cursor, without which Sequence would not have  
existed; my design is very much a derivative of his.

known problems:  
Some unit tests fail  
Buffered does not work at all  
Shifting’s modify methods don’t work reliably  
Some write operations failing for List  
No unit tests at all for array-like sequences  
(tho Reg’s unit test does test OfArray at least somewhat…)

---

<div class="post-metadata">

**Author:** ![pandemic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pandemic](https://www.ruby-forum.com/u/pandemic)\
**Post date:** [October 7, 2006, 8:05am UTC](https://www.ruby-forum.com/t/sequence-0-1-0-released/71341/2 "2006-10-07T08:05:43Z")

</div>

Caleb C. wrote:

> position (or anywhere at all), scanning for patterns (like  
> StringScanner, but it works in Files too, among others), and  
> saving a position that will remain valid even after data is  
> deleted or inserted elsewhere within the sequence.

[snip]

Sounds interesting… is it better than Eric M’s Cursor  
class? Different in some significant way?

Hal

---

<div class="post-metadata">

**Author:** ![pandemic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pandemic](https://www.ruby-forum.com/u/pandemic)\
**Post date:** [October 7, 2006, 6:48pm UTC](https://www.ruby-forum.com/t/sequence-0-1-0-released/71341/3 "2006-10-07T18:48:26Z")

</div>

On 10/6/06, Hal F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Sounds interesting… is it better than Eric M’s Cursor  
> class? Different in some significant way?

Well, Sequence is faster than Cursor for most things. I haven’t  
benchmarked, but (eg) #read should be at least 10-100x faster. (Except  
when reading from a file, which Cursor optimizes fairly well, if I  
remember.)

I think that the support for #scan and friends (from StringScanner) is  
better in Sequence. Eric will disagree with me on this.

Cursor doesn’t have an equivalent to my Sequence::Subseq.  
Cursor::Linked more or less corresponds to my Sequence::List (except  
that I never properly understood Cursor::Linked – how to use it, how  
it works).

Those are the biggest differences. The sequence api has otherwise  
about the same capabilities as its ancestor. I’ve moved everything  
around to suit my way of thinking, tho, so it isn’t compatible (except  
for doing very simple things).

---

<div class="post-metadata">

**Author:** ![pandemic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pandemic](https://www.ruby-forum.com/u/pandemic)\
**Post date:** [October 7, 2006, 8:28pm UTC](https://www.ruby-forum.com/t/sequence-0-1-0-released/71341/4 "2006-10-07T20:28:32Z")

</div>

On 10/7/06, Caleb C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I think that the support for #scan and friends (from StringScanner) is  
> for doing very simple things).

Sorry I haven’t been working on Cursor lately. I will readily admit  
that  
performance isn’t too great on Cursor. I was focusing on functionality  
first. Unfortunately when I go back and improve performance, I’ll be  
changing the API slightly. My focus for the year has been on Grammar  
which  
now has kick-ass performance (even faster than regexp’s when used in  
conjunction with Dominick Baton’s ruby2cext). It also has some  
interesting  
new features (like handling left recursion in an LL(1) parser). I’ll  
try to  
get some of this into CVS soon at least.

Because Grammar’s are on par (can be faster) with regexp’s I’ll be  
removing  
regexp support from Cursor in the next release. It is just too ugly to  
support in a clean way - they are too tied to String. Grammar on the  
other  
hand can work on anything that looks remotely like a Cursor - usually  
just  
#read1next will do. So, maybe it is best that Caleb made an derivative  
of  
Cursor since he really wanted regexp support. When I get back to  
Cursor,  
I’ll be improving performance quite a bit. I’ve been using C++ lately  
(which I hate) and will probably be taking some of the STL ideas (i.e.  
iterators, sequences, algorithms) I’ve learned over to Cursor. I think  
I’ll  
make it so that you can #extend some of ruby’s standard objects to look  
like  
a Cursor (or just #include in that class to make all of them look like  
Cursor’s). That should give very good performance.
