(defun x (a b c)
(let (square (sqrt (- (* b b) (* (* 4 a) c)))) (list square))
This code always produces (NIL) as output. Can't figure out why....
(defun x (a b c)
(sqrt (- (* b b) (* (* 4 a) c))))
This code returns ,with 1 2 3 as input, this strange looking output: #C(0 2.828427)
C# in front of aritmethic operation + let issue
Re: C# in front of aritmethic operation + let issue
It would be more obvious if you indented it properly:kapalua wrote:This code always produces (NIL) as output. Can't figure out why....
Code: Select all
(defun x (a b c)
(let (square
(sqrt (- (* b b) (* (* 4 a) c))))
(list square)))
'#C(...)' is a syntax for complex number literals. A square root of a negative number is a complex number. The specification even specifies the branch cut.kapalua wrote: This code returns ,with 1 2 3 as input, this strange looking output: #C(0 2.828427)