Queue/Definition: Difference between revisions
Content added Content deleted
m (→{{header|ATS}}) |
|||
Line 1,292: | Line 1,292: | ||
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. |
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 === |
=== A linear linked list as a queue === |