Panicz Maciej Godek <godek.mac...@gmail.com> writes:

>> (define (f) (define (g) (define (h) ((lambda x (cdr x)))) (h)) (g))
>> (f)
> <unnamed port>:13:0: In procedure #<procedure 24df3a0 at <current
> input>:13:0 x>:
> <unnamed port>:13:0: In procedure cdr: Wrong type argument in position
> 1 (expecting pair): ()
>
> Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue
>
>> ,bt
> In current input:
>      13:0  0 (#<procedure 24df3a0 at <current input>:13:0 x>)
>
> Why isn't the information about the subsequent procedures tracked? Do
> they all get inlined?

scheme@(guile-user)> ,optimize (define (f) (define (g) (define (h) ((lambda x 
(cdr x)))) (h)) (g))
$2 = (define (f) (cdr '()))

So, yes.

Though not relevant to this case, there is also another important factor
in your code, which is that all function calls are tail calls. So even
if you turned off optimisation, you would not see a complete backtrace.

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"

Reply via email to