1struct::stack(n)              Tcl Data Structures             struct::stack(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       struct::stack - Create and manipulate stack objects
9

SYNOPSIS

11       package require Tcl  8.2
12
13       package require struct::stack  ?1.3.3?
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

DESCRIPTION

32       The  ::struct  namespace  contains  a  commands  for  processing finite
33       stacks.
34
35       It exports a single command, ::struct::stack.  All  functionality  pro‐
36       vided here can be reached through a subcommand of this command.
37
38       Note:  As of version 1.3.3 of this package a critcl based C implementa‐
39       tion is available. This implementation however requires Tcl 8.4 to run.
40
41       The ::struct::stack command creates a new stack object with an  associ‐
42       ated  global  Tcl command whose name is stackName.  This command may be
43       used to invoke various operations on the stack.  It has  the  following
44       general form:
45
46       stackName option ?arg arg ...?
47              Option and the args determine the exact behavior of the command.
48              The following commands are possible for stack objects:
49
50       stackName clear
51              Remove all items from the stack.
52
53       stackName destroy
54              Destroy the stack, including its storage  space  and  associated
55              command.
56
57       stackName peek ?count?
58              Return  the  top count items of the stack, without removing them
59              from the stack.  If count is not specified, it  defaults  to  1.
60              If count is 1, the result is a simple string; otherwise, it is a
61              list.  If specified, count must be greater than or equal  to  1.
62              If  there  are  not  enoughs  items  on the stack to fulfull the
63              request, this command will throw an error.
64
65       stackName pop ?count?
66              Return the top count items of the stack, and  remove  them  from
67              the  stack.   If  count  is not specified, it defaults to 1.  If
68              count is 1, the result is a simple string; otherwise,  it  is  a
69              list.   If  specified, count must be greater than or equal to 1.
70              If there are not enoughs items  on  the  stack  to  fulfull  the
71              request, this command will throw an error.
72
73       stackName push item ?item...?
74              Push  the  item or items specified onto the stack.  If more than
75              one item is given, they will be pushed in  the  order  they  are
76              listed.
77
78       stackName size
79              Return the number of items on the stack.
80

BUGS, IDEAS, FEEDBACK

82       This  document,  and the package it describes, will undoubtedly contain
83       bugs and other problems.  Please report such in the category struct  ::
84       stack     of     the     Tcllib     SF     Trackers     [http://source
85       forge.net/tracker/?group_id=12883].  Please also report any  ideas  for
86       enhancements you may have for either package and/or documentation.
87

KEYWORDS

89       graph, matrix, queue, tree
90
91
92
93struct                               1.3.3                    struct::stack(n)
Impressum