home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Practical Programming in Tcl & Tk (4th Edition)
/
TCLBOOK4.BIN
/
pc
/
exsource
/
8_8.tcl
< prev
next >
Wrap
Text File
|
2003-04-16
|
267b
|
18 lines
#
# Example 8-8
# Using a list to implement a stack.
#
proc Push { stack value } {
upvar $stack list
lappend list $value
}
proc Pop { stack } {
upvar $stack list
set value [lindex $list end]
set list [lrange $list 0 [expr [llength $list]-2]]
return $value
}