tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
18
Task/Queue-Usage/Icon/queue-usage.icon
Normal file
18
Task/Queue-Usage/Icon/queue-usage.icon
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
procedure main(arglist)
|
||||
queue := []
|
||||
write("Usage:\nqueue x x x - x - - - - -\n\t- pops elements\n\teverything else pushes")
|
||||
write("Queue is:")
|
||||
every x := !arglist do {
|
||||
case x of {
|
||||
"-" : pop(queue) | write("pop(empty) failed.") # pop if the next arglist[i] is a -
|
||||
default : put(queue,x) # push arglist[i]
|
||||
}
|
||||
if empty(queue) then writes("empty")
|
||||
else every writes(!queue," ")
|
||||
write()
|
||||
}
|
||||
end
|
||||
|
||||
procedure empty(X) #: fail if X is not empty
|
||||
if *X = 0 then return
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue