14 lines
229 B
Text
14 lines
229 B
Text
|
|
class FIFO(*array) {
|
||
|
|
method pop {
|
||
|
|
array.is_empty && die "underflow";
|
||
|
|
array.shift;
|
||
|
|
}
|
||
|
|
method push(*items) {
|
||
|
|
array += items;
|
||
|
|
self;
|
||
|
|
}
|
||
|
|
method empty {
|
||
|
|
array.len == 0;
|
||
|
|
}
|
||
|
|
}
|