REBOL 3.0

POP goes the series

Carl Sassenrath, CTO
REBOL Technologies
31-Aug-2006 18:32 GMT

Article #0041
Main page || Index || Prior Article [0040] || Next Article [0042] || 23 Comments || Send feedback

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

REBOL 3.0
Updated 19-Jul-2017 - Edit - Copyright REBOL Technologies - REBOL.net