[incr-append
strick**20111007083704
 Ignore-this: 9eb3cf1af233957210bacf41831fa07d
] hunk ./tcl.hs 97
+getVar name = if head name == ':' then getGlobal (stripColons name) else getLocal name
+putVar name = if head name == ':' then putGlobal (stripColons name) else putLocal name
+
hunk ./tcl.hs 151
+      M.insert "incr" (Builtin builtin_incr) $
+      M.insert "append" (Builtin builtin_append) $
+      M.insert "lappend" (Builtin builtin_lappend) $
hunk ./tcl.hs 258
-builtin_set [name, value] = (if head name == ':' then putGlobal (stripColons name) else putLocal name) value
-builtin_set [name] = (if head name == ':' then getGlobal (stripColons name) else getLocal name)
+builtin_set [name, value] = putVar name value
+builtin_set [name] = getVar name
+
+builtin_incr [name, value] = do 
+  r <- getVar name
+  r `ifOk` \s -> putVar name (show (atoi s + atoi value))
+
+builtin_append [name, value] = do
+  r <- getVar name
+  r `ifOk` \s -> putVar name (s ++ value)
+
+builtin_lappend [name, value] = do
+  r <- getVar name
+  r `ifOk` \s -> putVar name (s ++ " " ++ value)
+
+builtin_puts [s] = do
+  lift $ putStrLn $ s
+  ok
hunk ./test.hs 67
+  goodScript "15" "set z 0; foreach i {1 2 3 4 5} {incr z $i}; set z"
+  goodScript "012345" "set z 0; foreach i {1 2 3 4 5} {append z $i}; set z"