Pwalk:
Filter:
Classes | Streams-Patterns-Events > Patterns > List

Pwalk : ListPattern : Pattern : AbstractFunction : Object

A one-dimensional random walk over a list of values that are embedded

Class Methods

Pwalk.new(list, stepPattern, directionPattern: 1, startPos: 0)

Arguments:

list

The items to be walked over.

stepPattern

Returns integers that will be used to increment the index into list.

directionPattern

Used to determine the behavior at boundaries. When the index crosses a boundary, the next direction is drawn from this stream: 1 means use stepPattern as is, -1 means go in the reverse direction. Common patterns:

1
always wrap around to the other boundary.
Pseq([1, -1], inf)
go forward first, then backward, then forward again.
startPos

Where to start in the list.

Inherited class methods

Instance Methods

Inherited instance methods

Undocumented instance methods

.directionPattern

.directionPattern = value

.embedInStream(inval)

.startPos

.startPos = value

.stepPattern

.stepPattern = value

Examples