File: queuep.lgt

package info (click to toggle)
yap 5.1.1-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 16,124 kB
  • ctags: 14,650
  • sloc: ansic: 122,796; perl: 22,545; sh: 3,768; java: 1,277; makefile: 1,191; xml: 739; tcl: 624; lisp: 142; awk: 9
file content (93 lines) | stat: -rw-r--r-- 2,058 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

:- protocol(queuep).


	:- info([
		version is 1.0,
		author is 'Paulo Moura',
		date is 2000/7/24,
		comment is 'Queue protocol.']).


	:- public(empty/1).

	:- mode(empty(@queue), zero_or_one).

	:- info(empty/1, [
		comment is 'True if the queue is empty.',
		argnames is ['Queue']]).


	:- public(head/2).

	:- mode(head(+queue, ?term), zero_or_one).

	:- info(head/2, [
		comment is 'Unifies Head with the first element of the queue.',
		argnames is ['Queue', 'Head']]).


	:- public(join/3).

	:- mode(join(@term, +queue, -queue), zero_or_one).

	:- info(join/3, [
		comment is 'Adds the new element at the end of the queue.',
		argnames is ['Element', 'Queue_in', 'Queue_out']]).


	:- public(join_all/3).

	:- mode(join_all(+list, +queue, -queue), zero_or_one).

	:- info(join_all/3, [
		comment is 'Adds the new elements at the end of the queue.  The elements are added in the same order that they appear in the list.',
		argnames is ['List', 'Queue_in', 'Queue_out']]).


	:- public(jump/3).

	:- mode(jump(@term, +queue, -queue), zero_or_one).

	:- info(jump/3, [
		comment is 'Adds the new element at the front of the queue.',
		argnames is ['Element', 'Queue_in', 'Queue_out']]).


	:- public(jump_all/3).

	:- mode(jump_all(+list, +queue, -queue), zero_or_one).

	:- info(jump_all/3, [
		comment is 'Adds the new elements at the front of the queue.  The elements are added in the same order that they appear in the list.',
		argnames is ['Element', 'Queue_in', 'Queue_out']]).


	:- public(length/2).

	:- mode(length(+queue, ?integer), zero_or_one).

	:- info(length/2,
		[comment is 'Queue length.',
		 argnames is ['Queue', 'Length']]).


	:- public(serve/3).

	:- mode(serve(+queue, ?term, -queue), zero_or_one).

	:- info(serve/3, [
		comment is 'Removes the first element of the queue for service.',
		argnames is ['Queue_in', 'Head', 'Queue_out']]).


	:- public(as_list/2).

	:- mode(as_list(+queue, -list), one).

	:- info(as_list/2,
		[comment is 'Converts a queue to a list.',
		 argnames is ['Queue', 'List']]).


:- end_protocol.