1struct::stack(n) Tcl Data Structures struct::stack(n)
2
3
4
5______________________________________________________________________________
6
8 struct::stack - Create and manipulate stack objects
9
11 package require Tcl 8.2
12
13 package require struct::stack ?1.3.1?
14
15 stackName option ?arg arg ...?
16
17 stackName clear
18
19 stackName destroy
20
21 stackName peek ?count?
22
23 stackName pop ?count?
24
25 stackName push item ?item ...?
26
27 stackName size
28
29_________________________________________________________________
30
32 The ::struct::stack command creates a new stack object with an associā
33 ated global Tcl command whose name is stackName. This command may be
34 used to invoke various operations on the stack. It has the following
35 general form:
36
37 stackName option ?arg arg ...?
38 Option and the args determine the exact behavior of the command.
39 The following commands are possible for stack objects:
40
41 stackName clear
42 Remove all items from the stack.
43
44 stackName destroy
45 Destroy the stack, including its storage space and associated
46 command.
47
48 stackName peek ?count?
49 Return the top count items of the stack, without removing them
50 from the stack. If count is not specified, it defaults to 1.
51 If count is 1, the result is a simple string; otherwise, it is a
52 list. If specified, count must be greater than or equal to 1.
53 If there are not enoughs items on the stack to fulfull the
54 request, this command will throw an error.
55
56 stackName pop ?count?
57 Return the top count items of the stack, and remove them from
58 the stack. If count is not specified, it defaults to 1. If
59 count is 1, the result is a simple string; otherwise, it is a
60 list. If specified, count must be greater than or equal to 1.
61 If there are not enoughs items on the stack to fulfull the
62 request, this command will throw an error.
63
64 stackName push item ?item ...?
65 Push the item or items specified onto the stack. If more than
66 one item is given, they will be pushed in the order they are
67 listed.
68
69 stackName size
70 Return the number of items on the stack.
71
73 graph, matrix, queue, tree
74
75
76
77struct 1.3.1 struct::stack(n)