Skip to content
laforge49 edited this page Jul 14, 2011 · 5 revisions

We define a sequence as an ordered series of key/value pairs. There are three reasons for this:

  1. Sequence actors over an unchanging collections are immutable.
  2. Sequence actors can be used by many other actors at the same time.
  3. A fast tail operation can be implemented.

There are 3 messages used to access the contents of a sequence.

case class First()
case class Current[K](key: K)
case class Next[K](key: K)

One way to think of a Current request is as the ceiling function on a navigable set, and Next can be thought of as the higher function.

The result returned by these requests are either null or an KVPair.

case class KVPair[K, V](key: K, value: V)

For many sequences, the values will be equal to the keys. But when we map a sequence, the keys remain unchanged while the values are updated. And when we have a sequence over a TreeMap, the key/value pairs are the same as the key/value pairs in the TreeMap.

Clone this wiki locally