Queue/Usage: Difference between revisions

→‎{{header|J}}: Added second example to demonstrate use of second technique.
m (→‎{{header|J}}: link to FIFO implementation)
(→‎{{header|J}}: Added second example to demonstrate use of second technique.)
Line 314:
 
=={{header|J}}==
Using object-oriented FIFO queue implementation from [[FIFO#J|FIFO]]
 
This is an interactive J session:
Line 336:
7
isEmpty__queue ''
1</lang>
 
Using function-level FIFO queue implementation from [[FIFO#J|FIFO]]
 
This is an interactive J session:
<lang j> is_empty make_empty _
1
first_named_state =: push 9 onto make_empty _
newer_state =: push 8 onto first_named_state
still_newer_state =: push 7 onto newer_state
is_empty still_newer_state
0
tell_queue still_newer_state
9 8 7
tell_atom pop still_newer_state
9
tell_atom pop pop still_newer_state
8
tell_atom pop pop pop still_newer_state
7
is_empty pop pop pop still_newer_state
1</lang>
 
Anonymous user