POP goes the series
There is a common REBOL idiom when series are used for queues and stacks:
pop: func [series /local val]
val: first series
remove series
val
]
Note that it works for any position within the series (you can pop from head, tail, or inbetween).
This common expression should be added as an internal action (high performance). Implementation is trivial (and it may even be possible to back-port it to REBOL 2).
Is the pop name the best choice?
Also, it may be good to extend it with /part allowing extraction of a range of series elements.
We've talked about this informally before. The discussion is now "formal", so what do you think?
23 Comments
|