[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trying to understand trace limit
From: |
Aleix Conchillo Flaqué |
Subject: |
Re: Trying to understand trace limit |
Date: |
Sat, 3 Oct 2020 00:15:20 -0700 |
Hi Dave,
On Mon, Sep 28, 2020 at 10:06 AM Dave Musicant <dmusicant@carleton.edu>
wrote:
> Hi all,
>
> I'm seeing some strange behavior with tracing code, which I'd love some
> help understanding. I've boiled it down to the following simplified
> example:
>
> (define count
> (lambda (n)
> (if (equal? n 1) 1
> (+ 1 (count (- n 1))))))
>
> ,tr (count 92)
>
>
> When I run the above code (in a fresh Guile instance, via redirecting
> from a file), the trace runs to completion.
>
> However, when I run this version of the code from a file, which runs the
> function twice...
>
> (define count
> (lambda (n)
> (if (equal? n 1) 1
> (+ 1 (count (- n 1))))))
>
> ,tr (count 10) ; runs to completion
> ,tr (count 92) ; dies mid-trace
>
>
> ... then the trace dies when it runs the second time, in something that
> must be some sort of stack overflow, though the error is fairly cryptic:
>
> While executing meta-command:
> In procedure +: Wrong type argument in position 1: #<unspecified>
>
> What's happening from a memory perspective where tracing the code the
> first time affects how much memory is available for the second time? It
> seems that the first run shouldn't affect the stack limit of the second,
> but something is going on.
>
> Thanks for the help.
> Dave
>
I've tried it with Guile 3.0.4 (in macOS) and I didn't get this error. What
version of Guile and OS are you using?
Aleix
- Re: Trying to understand trace limit,
Aleix Conchillo Flaqué <=