Pair:
Filter:
Classes | Collections > Ordered

Pair : Collection : Object

LISP-like two element cells
Source: Pair.sc

Description

NOTE: Implementation incomplete. See J concepts in SC for similar functionality.

Most methods are inherited from the superclasses.

Class Methods

Pair.new(linkDown, linkAcross)

Return new instance.

Pair.newFrom(collection)

Convert collection (e.g. arrays of arrays) to pairs.

Inherited class methods

Instance Methods

.size

Return the size when linking across.

.depth

Return the size when linking down.

.do(function)

Iterate over the two elements.

Traverse Same like: -depthFirstPreOrderTraversal

.depthFirstPreOrderTraversal(function)

Traverse the data structure first link down, then across (see examples).

.depthFirstPostOrderTraversal(function)

Traverse the data structure from bottom up (see examples).

Inherited instance methods

Undocumented instance methods

.linkAcross

.linkAcross = value

.linkDown

.linkDown = value

.traverse(function)

Examples