terminal - 未绑定(bind)变量 'trace'

标签 terminal scheme trace guile

我正在尝试使用 guile 函数跟踪,但每次这样做,我都会得到一个可能的未绑定(bind)变量。

scheme@(guile-user)> (define (fact1 n)
(if (zero? n) 1
(* n (fact1 (- n 1)))))
scheme@(guile-user)> (trace fact1)
;;; <stdin>:4:0: warning: possibly unbound variable `trace'
<unnamed port>:4:0: In procedure #<procedure 10e4080c0 at <current input>:4:0 ()>:
<unnamed port>:4:0: In procedure module-lookup: Unbound variable: trace

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> 

我想知道是否有人知道为什么这不起作用。

最佳答案

使用,trace :

GNU Guile 2.0.12
Copyright (C) 1995-2016 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (define (fact1 n)
... (if (zero? n) 1
... (* n (fact1 (- n 1)))))
scheme@(guile-user)> ,trace (fact1 5)
trace: |  (#<procedure 110221480> #(#<directory (guile-user) 10f9fabd0> #f))
trace: |  #(#<directory (guile-user) 10f9fabd0> fact1)
trace: (#<procedure 11022e1e0 at <current input>:2:0 ()>)
trace: (fact1 5)
trace: |  (fact1 4)
trace: |  |  (fact1 3)
trace: |  |  |  (fact1 2)
trace: |  |  |  |  (fact1 1)
trace: |  |  |  |  |  (fact1 0)
trace: |  |  |  |  |  1
trace: |  |  |  |  1
trace: |  |  |  2
trace: |  |  6
trace: |  24
trace: 120

关于terminal - 未绑定(bind)变量 'trace',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40644544/

相关文章:

bash - bash脚本将服务传递给变量

scheme - 把 7 不是 (7) 排除在列表之外?

方案 - 将 boolean 值转换为字符串?

python - 在 Python 中寻找片状测试的根本原因

Java 应用程序分析/跟踪

linux - 内核挂tty子系统

ssh - 谷歌云终端问题

npm install global 无法在 mac 上运行,说我没有权限?缺少对/usr/local/lib/node_modules 的写访问权限

linux - 如何按原样将 '=' 传递给终端命令(Linux/macOS)?

scheme - 如果文件名已在列表中,则将其删除