我对 lisp 很陌生,我正在研究基本语法。我正在尝试将:
r1 = (-b + sqrt(b^2 - 4*a*c))/(2*a)
转换为 lisp 格式。我认为我遇到的唯一问题是我无法让 lisp 将 -b 识别为符号 b 的负值。这是我到目前为止从 lisp 提示符中得到的:
[17]> (setq a 1L0)
1.0L0
[18]> (setq b -1L0)
-1.0L0
[19]> (setq c -1L0)
-1.0L0
[20]> (setq r1 (+ (/ (sqrt (- (power b 2) (* (* 4 a) c))) (* 2 a)) -b))
*** - EVAL: variable -B has no value
The following restarts are available:
USE-VALUE :R1 You may input a value to be used instead of -B.
STORE-VALUE :R2 You may input a new value for -B.
ABORT :R3 Abort main loop