程序?为变量返回false

时间:2016-02-24 05:12:08

标签: scheme racket

所以这行代码:

(procedure? (eval x))
当x是一个过程时,

计算为true,但如果x是一个变量,则不起作用,因为我得到以下错误:

cannot reference undefined identifier

如何重写代码片段,使其在x为变量时计算为false,在x为真时为true?

1 个答案:

答案 0 :(得分:2)

为什么使用Sub Lock_cells() Dim rng As Range Dim x As Date x = Now() - 3 ActiveSheet.Unprotect "password" Dim cl As Range Set rng = Range("F3:F499") For Each cl In rng.Cells If UCase(cl.Value) = UCase("500") And cl.Offset(0, -5).Value < x Then If Weekday(cl.Offset(0, -5).Value, vbMonday) < 6 Then Range("a" & cl.Row & ":F" & cl.Row).Locked = True Else Range("a" & cl.Row & ":F" & cl.Row).Locked = False End If End If Next ActiveSheet.Protect "password" End Sub eval作为参数传递给x之前会自动进行评估,因此您只需使用procedure?

(procedure? x)