{"size": 1316, "ext": "scrbl", "max_stars_repo_path": "htdp-trace/scribblings/htdp-trace.scrbl", "max_stars_repo_name": "djh-uwaterloo/uwaterloo-racket", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "htdp-trace/scribblings/htdp-trace.scrbl", "max_issues_repo_name": "djh-uwaterloo/uwaterloo-racket", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "htdp-trace/scribblings/htdp-trace.scrbl", "max_forks_repo_name": "djh-uwaterloo/uwaterloo-racket", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 34.6315789474, "max_line_length": 99, "alphanum_fraction": 0.5121580547}
#lang scribble/manual
@require[@for-label[htdp-trace
                    racket/base]
         scribble/example racket/sandbox
         ]
@(define my-eval
   (parameterize ([sandbox-output 'string]
                  [sandbox-error-output 'string]
                  [sandbox-memory-limit 50])
     (make-evaluator 'racket)))

@title{HTDP Trace}
@author{djholtby}


@defmodule[htdp-trace]

Racket has a useful tracing tool.  Unfortunately it does not work in Beginning Student.
This package provides a wrapper that can be used in the HtDP Languages.

@defform[(define/trace (name param ...) body)
         ]{Behaves the same as @racket[define], but whenever the function @racket[name] is applied,
                               the values of its parameters will be printed to the screen.
 When the function produces a value, that value will also be printed.

            @examples[#:eval my-eval #:no-prompt
                      (require htdp-trace)
                      (define/trace (f x)
                       (+ 2 x))
                      (f 2)
                      
                      (define/trace (sum-nums n)
                       (cond [(zero? n) 0]
                             [else (+ n (sum-nums (- n 1)))]))
                       (sum-nums 3)]} 
                                              

