21 lines
356 B
Text
21 lines
356 B
Text
define :queue [
|
|
init: method [][
|
|
this\items: []
|
|
]
|
|
|
|
empty?: method [][
|
|
zero? this\items
|
|
]
|
|
|
|
push: method [item][
|
|
this\items: this\items ++ item
|
|
]
|
|
|
|
pop: method [][
|
|
ensure -> [not? this\empty?]
|
|
|
|
result: this\items\0
|
|
this\items: remove.index this\items 0
|
|
return result
|
|
]
|
|
]
|