Exercises
Using the
random
procedure (page 518), write a Tk script that draws a plot of a large number of random values. Use time (modulo the plot width) as the second dimension in the plot. Look for patterns in the plot.Many Tcl extensions come with libraries that are used by the extension itself but are not documented for users. Look through all the Tcl libraries for useful but undocumented utilities.
Check the version of Expect that you are running. See if you can find a later one. Do your scripts still work?
Use the
time
command and compare "string match
" againstregexp
doing similar things. Is this reflected in the-gl
and-re
flags in theexpect
command?Time the UNIX
sleep
command and compare it to the built-insleep
command. At what point is the difference moot? How does this change if you are on a much slower or faster machine?What
timestamp
would exactly duplicate the default output of the UNIXdate
command? Timedate
andtimestamp
.Expect does not have a procedure that does the opposite of
timestamp
—converts a string to a date represented as an integer. Why is that? Write one anyway.
Get Exploring Expect now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.