问题描述
为什么说变量addFraction
是未绑定的?
(defun addFraction (N1 D1 N2 D2)
(format t "~d ~d"
(+ (+ (lcm D1 D2) N1) (+ (lcm D1 D2) N2))
(lcm D1 D2)))
当我运行代码时,它会说:
#<THREAD "main thread" RUNNING {10010B0523}>:
The variable ADDFRACTION is unbound.
Type HELP for debugger help,or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE ] Retry using ADDFRACTION.
1: [USE-VALUE ] Use specified value.
2: [STORE-VALUE] Set specified value and use it.
3: [ABORT ] Exit debugger,returning to top level.
(SB-INT:SIMPLE-EVAL-IN-LEXENV ADDFRACTION #<NULL-LEXENV>)
0]
解决方法
我的坏人!
当我调用输入的函数时
(addFunction 1 2 1 4)
代替
import SwiftUI
extension View {
func showIf(condition: Bool) -> AnyView {
if condition {
return AnyView(self)
}
else {
return AnyView(EmptyView())
}
}
}