Version: v0.0.0-...-ed07a65 Latest Latest Go to latest
Published: Sep 19, 2019 License: BSD-3-Clause

## Documentation ¶

### Constants ¶

This section is empty.

### Variables ¶

This section is empty.

### Functions ¶

This section is empty.

### Types ¶

#### type Iterator ¶

```type Iterator interface {
// Elem returns the element at the current position.
Elem() interface{}
// HasElem returns whether the iterator is pointing to an element.
HasElem() bool
// Next moves the iterator to the next position.
Next()
}```

Iterator is an iterator over vector elements. It can be used like this:

```for it := v.Iterator(); it.HasElem(); it.Next() {
elem := it.Elem()
// do something with elem...
}
```

#### type Vector ¶

```type Vector interface {
// Len returns the length of the vector.
Len() int
// Index returns the i-th element of the vector, if it exists. The second
// return value indicates whether the element exists.
Index(i int) (interface{}, bool)
// Assoc returns an almost identical Vector, with the i-th element
// replaced. If the index is smaller than 0 or greater than the length of
// the vector, it returns nil. If the index is equal to the size of the
// vector, it is equivalent to Cons.
Assoc(i int, val interface{}) Vector
// Cons returns an almost identical Vector, with an additional element
// appended to the end.
Cons(val interface{}) Vector
// Pop returns an almost identical Vector, with the last element removed. It
// returns nil if the vector is already empty.
Pop() Vector
// SubVector returns a subvector containing the elements from i up to but
// not including j.
SubVector(i, j int) Vector
// Iterator returns an iterator over the vector.
Iterator() Iterator
}```

Vectors from elvish. I'm not convinced a lot of the claims were correct so I stripped the comment. I'm not sure how much of what this does we need, e.g. SubVector, but we'll see.

`var Empty Vector = &vector{}`

Empty is an empty Vector.