Range.untail

Returns the range without its last element, and that last element.

Arguments

None

Return values

The remaining

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

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; h: ((1 "ONE") (2 "TWO")) makeHashTable; r:t: l.makeRange.untail;; hr:ht: h.makeRange.untail;; r [print "," print TRUE] enum t print LF print hr [print "," print TRUE] enum ht print
Output:
1,2,3,-1,-2,-3,10,20,30,-10,-20,-30 { key: 1; value: "ONE"; },{ key: 2; value: "TWO"; }