7 Using MLWorks in TTY Mode
The TTY inspector inspects the value of it
, whatever that may be at the time the inspector is invoked. To invoke the inspector, call the built-in interactive environment function Shell.Inspector.inspectIt
. For example:
MLWorks> [["a", "b"], ["c", "d"]]; val it : string list list = [["a", "b"], ["c", "d"]]The TTY inspector allows you to navigate the value being inspected recursively. As you can see, at each stage it prints a numbered list of subvalues of the current value. It supports the following commands:MLWorks> Shell.Inspector.inspectIt(); Entering TTY inspector - enter ? for help Value: [["a", "b"], ["c", "d"]] Type: string list list 0: ["a", "b"] 1: ["c", "d"] Inspector>
<field name>
p
q
Inspector> 0 Value: ["a", "b"] Type: string list 0: "a" 1: "b" Inspector> 1 Value: "b" Type: string Inspector> p Value: ["a", "b"] Type: string list 0: "a" 1: "b" Inspector> q val it : unit = () MLWorks>The TTY inspector supports inspector methods. Inspector methods allow you to apply a function whenever a value of a particular type is inspected. You could, for example, control the printing style for values of certain types your application defines. Inspector methods must be compiled in debugging mode. For more on inspector methods, see the section on
Shell.Inspector
in the MLWorks Reference Manual.
Generated with Harlequin WebMaker