[racket] how to trace stack by command line tools?

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Feb 2 14:32:28 EST 2012

A few minutes ago, Danny Yoo wrote:
> Here's how to work around this:  you can add the following right after
> a definition, such as f:
> 
>     #lang racket
>     (require racket/trace)
>     (define (f x) (* x x))
>     (set! f f)
> 
> The set! there is a no-op, but it effectively tells Racket not to
> enforce the constantness of f.  Then trace can be run on it from
> Interactions.

Perhaps an easier approach is to just trace it inside the definitions:

    #lang racket
    (require racket/trace)
    (define (f x) (* x x))
    (trace f)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.