[r6rs-discuss] Question re trace

Dave Penton djp at arqux.com
Fri Sep 3 09:34:11 EDT 2010


On 2010-09-02, at 1:03 PM, Andreas Rottmann wrote:

> Dave Penton <djp at arqux.com> writes:
> 
>> I don't know if this list is an appropriate spot to ask a beginner's
>> question. If not, send me to the right place please. I don't see a
>> search function on the list archives, so I'll just ask:
>> 
>> What is the status of "trace" in R6RS?
>> 
>> I am using the Dybvig book on Scheme to learn, having started last
>> year with Common Lisp. I need to know Scheme for some work pertaining
>> to current topics in my grad program.
>> 
>> The Dybvig book refers to the trace function without further
>> explanation. Is this part of the language? I don't see any mention of
>> it in docs on the R6RS website.
>> 
> No, `trace' is not part of R6RS, but most Scheme implementations provide
> some facility along its lines.
> 
>> I can use trace in Chez Scheme, but not for example in Racket (with
>> language set to R6RS). 
>> 
> In Racket, you should be able to use `trace' from the `racket/trace'
> module, which you can import as follows in R6RS programs:
> 
> #!r6rs
> 
> (import (rnrs)
>        (racket trace))
> 
> (define (f x)
>  (if (zero? x)
>      0
>      (+ 1 (f (- x 1)))))
> 
> (trace f)
> (display (f 10))
> (newline)
> ;;-- EOF --
> 
> Ikarus, to give another example, has `trace-define' and `trace-lambda',
> which work a bit differently.
> 
>> I don't know how to find out why this might be so, what the status of
>> trace is in the language, etc.
>> 
> My guess is that it's not standardized since it's a debugging aid, which
> will not be used in "regular" code, but just during development.
> 
> Regards, Rotty
> -- 
> Andreas Rottmann -- <http://rotty.yi.org/>

Fantastic. Your sample code worked as intended.

I have not yet learned about 'import', module libraries etc. in Scheme or Racket. But I did want to use trace as part of my learning process.

Thanks a million.

Best,

- Dave -




More information about the r6rs-discuss mailing list