Queue/Definition: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: syntax coloured, added builtin comment) |
(Applesoft BASIC) |
||
Line 843: | Line 843: | ||
Put_Line(Integer'Image(Val)); |
Put_Line(Integer'Image(Val)); |
||
end select; |
end select; |
||
end loop; |
end loop;<lang ada> |
||
end Reader; |
end Reader; |
||
begin |
begin |
||
Line 988: | Line 988: | ||
barney |
barney |
||
</pre> |
</pre> |
||
=={{header|Applesoft BASIC}}== |
|||
<lang ApplesoftBasic> 0 DEF FN E(MPTY) = SP = 0 |
|||
10 GOSUB 150EMPTY |
|||
20 LET A$ = "A": GOSUB 100PUSH |
|||
30 LET A$ = "B": GOSUB 100PUSH |
|||
40 GOSUB 150EMPTY |
|||
50 GOSUB 120 POP |
|||
60 GOSUB 120 POP |
|||
70 GOSUB 150EMPTY |
|||
80 GOSUB 120 POP |
|||
90 END |
|||
100 PRINT "PUSH "A$ |
|||
110 LET S$(SP) = A$:SP = SP + 1: RETURN |
|||
120 GOSUB 130: PRINT "POP "A$: RETURN |
|||
130 IF FN E(0) THEN PRINT "POPPING FROM EMPTY QUEUE";: STOP |
|||
140 LET SP = SP - 1:A$ = S$(SP): RETURN |
|||
150 PRINT "EMPTY? " MID$ ("YESNO",4 ^ FN E(0),3): RETURN</lang> |
|||
=={{header|ARM Assembly}}== |
=={{header|ARM Assembly}}== |