guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trace-calls-to-procedure


From: Tim Meehan
Subject: Re: trace-calls-to-procedure
Date: Fri, 25 Dec 2020 19:23:28 -0600

Neat! I didn't notice that (even though I am sure that I saw it come up on
the REPL).
It is indeed weird ...
Looks like a time to read some of the source for "(system vm trace)" ...

On Thu, Dec 24, 2020 at 11:58 PM Zelphir Kaltstahl <
zelphirkaltstahl@posteo.de> wrote:

> Hi Tim!
>
> I do not know the answer to your question, but I noticed something else:
> trace-calls-to-procedure returns a procedure. That procedure and its return
> value can be applied infinitely, it seems:
>
> ~~~~
> scheme@(guile-user)> (import (system vm trace))
> scheme@(guile-user)> (define (sqr x)
>     (* x x))
> scheme@(guile-user)> (trace-calls-to-procedure sqr)
> $1 = #<procedure 7f25860f4e80 at system/vm/traps.scm:599:6 (#:optional frame)>
> scheme@(guile-user)> ((trace-calls-to-procedure sqr) 9)
> $2 = #<procedure 7f25861ac1c0 at system/vm/traps.scm:596:8 (#:optional frame)>
> scheme@(guile-user)> (((trace-calls-to-procedure sqr) 9))
> $3 = #<procedure 7f2586624660 at system/vm/traps.scm:599:6 (#:optional frame)>
> scheme@(guile-user)> ((((trace-calls-to-procedure sqr) 9)))
> $4 = #<procedure 7f25861e9280 at system/vm/traps.scm:596:8 (#:optional frame)>
> scheme@(guile-user)>
> ~~~~
>
> Not sure if that helps :D
>
> Regards,
> Zelphir
> On 12/25/20 5:51 AM, Tim Meehan wrote:
>
> I have used ",trace" before and get what it is supposed to do, but I am not
> sure what "trace-calls-to-procedure" is supposed to do ...
>
> ;; Using Guile 3.0.4
> (use-modules (system vm trace))
>
> (define (sqr x)
>     (* x x))
>
> (trace-calls-to-procedure sqr)
>
> (sqr 3)
>
> ;; ... and nothing happens ... is something supposed to happen?
>
> --
> repositories: https://notabug.org/ZelphirKaltstahl
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]