next up previous contents index
Next: Apply-to-each Up: Implementation Notes Previous: Implementation Notes

The Sequence Functions

In the current implementation the equations for the work performend by some of the sequence functions depends on whether the sequence is nested or not. Table 4 gives the complexities for these functions. A sequence is considered nested if its elements contain sequences. A sequence of pairs of scalars or pairs is not considered nested. The function LL(a) refers the the length of a if it was flattened until it has just one level of nesting. For example, LL([[[2, 3], [1], [8, 9, 10]], [[1, 2, 3, 4]]]) would be 4, since when flattened to one level of nesting it has the value [[2, 3], [1], [8, 9, 10], [1, 2, 3, 4]], which has length 4. In rep and <-, the work complexity for flat sequences depends on whether the variable used for d is the final reference to that variable (arguments are evaluated left to right). If it is the final reference, then the complexity before the comma is used, otherwise the complexity after the comma is used.

   table8255
Table: Work complexities of some of the sequence functions in the current implementation. In all cases the flat vs. nested refers to the variable a. S(v) refers to the size of the object v and LL(v) is described in the text.



Jonathan Hardwick
Tue Nov 28 13:57:00 EST 1995