【发布时间】:2020-02-25 14:02:55
【问题描述】:
假设我在 Redex 中定义了以下内容:
(define-language L
[e ::= (λ x e) (e e) x]
[x ::= variable-not-otherwise-mentioned]
#:binding-forms
(λ x e #:refers-to x))
现在,我认为表达式(λ y x) x 的意思是:
将x(上述表达式中的大括号内)中出现的y 替换为x(大括号外)。由于x 中没有y,所以答案应该只是x。然后(λ y x) x y 应该返回x y。但是:
(default-language L)
(term (substitute (λ y x) x y))
'(λ y«0» y)
为什么它返回一个函数? y<<0>> 是什么意思?我是不是误会term (substitute ..)?
我也不明白这个结果:
(term (substitute (λ y x) x true))
'(λ y«1» true)
有人可以帮我破译这个吗?我是 Racket/Redex 的新手。
【问题讨论】:
标签: lambda racket substitution redex