Queue/Usage: Difference between revisions

m
(added Arturo)
 
(5 intermediate revisions by 3 users not shown)
Line 1,181:
 
E also has queues in the standard library such as <code>&lt;import:org.erights.e.examples.concurrency.makeQueue></code>, but they are designed for concurrency purposes and do not report emptiness but rather return a promise for the next element.
 
=={{header|EasyLang}}==
Uses the queue-definition given at [[Queue/Definition#EasyLang]]
<syntaxhighlight>
#
# queue definition
#
##
qu_enq 2
qu_enq 5
qu_enq 7
while qu_empty = 0
print qu_deq
.
</syntaxhighlight>
 
=={{header|Elena}}==
ELENA 46.x :
<syntaxhighlight lang="elena">import system'collections;
import extensions;
Line 1,192 ⟶ 1,207:
var queue := new Queue();
queue.push:(1);
queue.push:(3);
queue.push:(5);
// "Pop" items from the queue in FIFO order
Line 1,206 ⟶ 1,221:
// If we try to pop from an empty queue, an exception
// is thrown.
queue.pop() |\\ on::(e){ console.writeLine:("Queue empty.") }
}</syntaxhighlight>
 
Line 3,108 ⟶ 3,123:
=={{header|Wren}}==
{{libheader|Wren-queue}}
<syntaxhighlight lang="ecmascriptwren">import "./queue" for Queue
 
var q = Queue.new()
1,964

edits