Stack
# # Create a stack class # Class Stack Stack instproc init {} { # Constructor my instvar things set things "" } Stack instproc push {thing} { my instvar things set things [concat [list $thing] $things] return $thing } Stack instproc pop {} { my instvar things set top [lindex $things 0] set things [lrange $things 1 end] return $top }