Queue/Definition: Difference between revisions

m
Line 1,291:
 
A common theme in these examples is that there is no runtime error for popping from an empty queue. Instead, you simply cannot compile a program that tries to pop from an empty queue. The type of a queue depends on its size, and you will get a type error if that size is not proven to be nonzero.
 
(One way to get such a proof is with an assertion that calls the ''is_empty'' predicate. But the compiler does not insert that check for you, and the example programs do not need it.)
 
=== A linear linked list as a queue ===
1,448

edits