Here is my program:
Code: Select all
(defun fact (n)
(if (<= n 1)
1
(* n (fact (1- n)))))
(defmacro odd (n)
`(1+ (* ,n 2)))
(defun sine (n &optional (a 3)) ;n is the number, a is the accuracy
(let ((result n))
((dotimes (i a)
(if (mod (1+ i) 2)
(setf result (- result (/ (expt n (odd (1+ i))) (fact (odd 1+ i)))))
(setf result (+ result (/ (expt n (odd (1+ i))) (fact (odd 1+ i))))))))))
Code: Select all
While compiling SINE :
In the form (#1=(DOTIMES (I A)
(IF (MOD # 2)
(SETF RESULT #)
(SETF RESULT
#)))), #1# is not a symbol or lambda expression.
[Condition of type CCL::COMPILE-TIME-PROGRAM-ERROR]
