SICP、Scheme、DrRacket 问题:定时器/分析器功能?

发布于 2024-09-25 17:35:28 字数 155 浏览 1 评论 0原文

我目前正在尝试做练习1.22,它需要一个名为runtime 的函数,它返回系统已运行的毫秒数。然而我的环境(R5RS)似乎没有这个。它也没有时间、当前毫秒、当前不精确毫秒等。

我可以访问什么功能来分析我的功能?哪些函数返回已经过去的毫秒数、微秒数等?我当然更喜欢最高精度的计时器。

I'm currently trying to do exercise 1.22, which needs a function called runtime that returns the number of milliseconds the system has been running. However, my environment (R5RS) does not seem to have this. It does not have time, current-milliseconds, current-inexact-milliseconds, etc, either.

What function do I have access to, to profile my function? Which functions returns the number of milliseconds, microseconds, etc, that have passed? I would of course prefer the highest precision timer available.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心舞飞扬 2024-10-02 17:35:28

也许,最好的办法是将 DrRacket 中的语言切换为“使用源代码中声明的语言”,并以 #langracket 开始您的文件。然后诸如current-seconds之类的函数将可用。

或者,您可以使用分析库,可通过 (require profile) 获取并记录 这里

最后,您可能需要查看 Neil Van Dyke 的 DrRacket 的 SICP 库

Probably, the best thing to do is switch the language in DrRacket to "Use the language declared in the source", and start your file with #lang racket. Then functions like current-seconds and friends will be available.

Alternatively, you could use the profiling library, available via (require profile) and documented here.

Finally, you might want to look at Neil Van Dyke's SICP library for DrRacket.

春夜浅 2024-10-02 17:35:28

我用了 当前不精确毫秒 当我做那个练习时。 剧透警告:您可以在我的博客上查看我的解决方案:SICP 练习 1.22:定时 Prime 测试

顺便说一句,我只是在问了类似的问题后才解决了这个问题, Scheme 中是否有相当于 Lisp 的“运行时”原语?

I used current-inexact-milliseconds when I did that exercise. Spoiler Alert: You can see my solution on my blog at SICP Exercise 1.22: Timed Prime Test.

By the way, I only solved that problem after asking a similar question, Is there an equivalent to Lisp's “runtime” primitive in Scheme?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文