Next: , Previous: , Up: rope API   [Contents][Index]


2.2 Getters

Procedure: rope-left rope

The left child of the rope. This procedure expects a rope and will raise an exception otherwise.

Procedure: rope-right rope

The right child of the rope. This procedure expects a rope and will raise an exception otherwise.

Procedure: rope-length rope

The length of the rope, which is either the sum of the lengths of its children, or in the case that a string is passed to rope-length, then it is the length of that string.

Procedure: rope-depth rope

The depth the rope, which is either one above the larger of the depths of its children, or in the case that a string is passed to rope-depth, then it is ‘0’.

Procedure: rope-ref rope index

The character stored at index of the rope.

(rope-ref (rope "abcde" "fghij") 6)
  ⇒ #\g

Example 2.1: The seventh character of a rope representing the string ‘abcdefghi’.