2 \xe2\x80\x93 (-12/x) = -4
\n\n负数12让我很困惑。我该把负号放在哪里?
\n\n(define (math x)\n( = ( - ( / 12 x) 2) 4))\nRun Code Online (Sandbox Code Playgroud)\n
负号是数字本身的一部分,您可以像使用任何其他语言一样编写它:
(define (math x)
( = ( - ( / -12 x) 2) 4))
Run Code Online (Sandbox Code Playgroud)
输出:
> (math 2) ; 2-(-12/2) = -4 -> 2-(-6) = -4 -> 2 + 6 = -4 -> 8 = -4 (FALSE)
#f
> (math -2) ; 2-(-12/-2) = -4 -> 2-(6) = -4 -> -4 = -4 (TRUE)
#t
Run Code Online (Sandbox Code Playgroud)