Range.unhead

Returns the first element of the range and the remaining range.

Arguments

None

Return values

value
or
{ key: Key; value: Value; }
structure of the first element, depending on the range type.
The remaining
range
.

Complexity

Constant, O(log(size)) for RedBlackTree.

Example

"sl/array" useFile "sl/hashTable" useFile l: (1 2 3 -1 -2 -3 10 20 30 -10 -20 -30) makeArray; ht: ((1 "ONE") (2 "TWO")) makeHashTable; h:r: l.makeRange.unhead;; hh:hr: ht.makeRange.unhead;; h print r ["," print print TRUE] enum LF print hh print hr ["," print print TRUE] enum
Output:
1,2,3,-1,-2,-3,10,20,30,-10,-20,-30 { key: 1; value: "ONE"; },{ key: 2; value: "TWO"; }