2 USING: kernel namespaces sequences math
3 listener io prettyprint sequences.lib fry ;
7 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9 SYMBOL: watched-variables
11 : watch-var ( sym -- ) watched-variables get push ;
13 : watch-vars ( seq -- ) watched-variables get [ push ] curry each ;
15 : unwatch-var ( sym -- ) watched-variables get delete ;
17 : unwatch-vars ( seq -- ) watched-variables get [ delete ] curry each ;
19 : print-watched-variables ( -- )
20 watched-variables get length 0 >
24 watched-variables get [ unparse ] map longest length 2 +
25 '[ [ unparse ": " append , 32 pad-right write ] [ get . ] bi ]
31 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
33 : display-stack ( -- )
34 V{ } clone watched-variables set
36 print-watched-variables
40 retainstack reverse [ . ] each