[ Reference Manual | Alphabetic Index ]

library(queues)

define queue operations   [more]

Predicates

empty_queue(Queue)
tests whether the queue is empty
head_queue(Queue, Head)
unifies Head with the first element of the queue
join_queue(Element, OldQueue, NewQueue)
adds the new element at the end of the queue
jump_queue(Element, OldQueue, NewQueue)
adds the new element at the front of the list
length_queue(Queue, Length)
counts the number of elements currently in the queue
list_join_queue(List, OldQueue, NewQueue)
adds the new elements at the end of the queue
list_jump_queue(List, OldQueue, NewQueue)
adds all the elements of List at the front of the queue
list_to_queue(List, Queue)
creates a new queue with the same elements as List
make_queue(Queue)
creates a new empty queue
queue_to_list(Queue, List)
creates a new list with the same elements as Queue
serve_queue(OldQueue, Head, NewQueue)
removes the first element of the queue for service

Description

In this package, a queue is represented as a term Front-Back, where Front is a list and Back is a tail of that list, and is normally a variable. join_queue will only work when the Back is a variable, the other routines will accept any tail. The elements of the queue are the list difference, that is, all the elements starting at Front and stopping at Back. Examples:

	[a,b,c,d,e|Z]-Z	    has elements a,b,c,d,e
	[a,b,c,d,e]-[d,e]   has elements a,b,c
	Z-Z		    has no elements
	[1,2,3]-[1,2,3]	    has no elements

About


Generated from queues.eci on 2017-09-08 15:30