Download MIT/GNU Scheme User`s Manual - Mirror
Transcript
52 MIT/GNU Scheme User’s Manual a a a a a string-search-forward substring-search-all substring-search-backward substring-search-forward vector-binary-search 5.4 Advising Procedures Giving advice to procedures is a powerful debugging technique. trace and break are useful examples of advice-giving procedures. Note that the advice system only works for interpreted procedures. trace-entry procedure procedure+ Causes an informative message to be printed whenever procedure is entered. The message is of the form [Entering #[compound-procedure 1 foo] Args: val1 val2 ...] where val1, val2 etc. are the evaluated arguments supplied to the procedure. (trace-entry (fib 3) a [Entering Args: a a [Entering Args: a a [Entering Args: a ⇒ 3 fib) #[compound-procedure 19 fib] 3] #[compound-procedure 19 fib] 1] #[compound-procedure 19 fib] 2] trace-exit procedure procedure+ Causes an informative message to be printed when procedure terminates. The message contains the procedure, its argument values, and the value returned by the procedure. (trace-exit fib) (fib 3) a [1 <== #[compound-procedure 19 fib] a Args: 1] a a [2 <== #[compound-procedure 19 fib] a Args: 2] a a [3 <== #[compound-procedure 19 fib] a Args: 3] a ⇒ 3