【问题标题】:(Unbound variable) Use functions on a list of S-Expressions (mit-scheme)(未绑定变量)在 S-Expressions 列表上使用函数(mit-scheme)
【发布时间】:2026-01-06 00:00:01
【问题描述】:

我正在尝试在 S 表达式列表中使用一个函数,但它只会给我一个错误 "Unbound variable butter"

(depth* (()
         ((bitter butter)
          (makes)
          (butter bitter)
         butter)))

【问题讨论】:

    标签: list variables scheme s-expression


    【解决方案1】:

    您似乎忘记引用 s 表达式,试试这个:

    (depth* '(() ; notice the quote at the start of the list
              ((bitter butter)
               (makes)
               (butter bitter)
               butter)))
    

    【讨论】: