I've written a LISP-program, it writes some output data to the CommonLisp console via princ and write-line operators. How to redo it to it writes output data to the file? My program:
(defun printTriangle()
(
progn
(let((countx xmin)(county ymin)(koeff1 nil)(koeff2 nil))
(loop
(cond ((> county ymax)(return "")))
(loop
(cond ((> countx xmax)(return "")))
(if (equal (- countx (car(nth (- (length line1)1) line1))) 0)(setf divisionByZeroKoef1 1)(setf divisionByZeroKoef1 0))
(if (equal (- countx (cadar line1)) 0)(setf divisionByZeroKoef2 1)(setf divisionByZeroKoef2 0))
(if (or(equal divisionByZeroKoef1 1)(equal divisionByZeroKoef2 1))
(
progn
(setf koeff1 (- county (cadr(nth (- (length line1)1) line1))))
(setf koeff2 (- county (caar line1)))
(if (or
(and
(and(>= (- koeff1 koeffHyp1)-0.8)(<= (- koeff1 koeffHyp1)0.8))
(and(>= (- koeff2 koeffHyp2)-0.8)(<= (- koeff2 koeffHyp2)0.8))
(<= ymin county)
(>= ymax county)
(<= xmin countx)
(>= xmax countx)
)
(equal (memberList line1 (list countx county)) 1)
)
(princ "*")
(princ "-")
)
)
(
progn
(setf koeff1 (/(- county (cadr(nth (- (length line1)1) line1)))(- countx (car(nth (- (length line1)1) line1)))))
(setf koeff2 (/(- county (caar line1))(- countx (cadar line1))))
(if (or
(and
(and(>= (- koeff1 koeffHyp1)-0.8)(<= (- koeff1 koeffHyp1)0.8))
(and(>= (- koeff2 koeffHyp2)-0.8)(<= (- koeff2 koeffHyp2)0.8))
(<= ymin county)
(>= ymax county)
(<= xmin countx)
(>= xmax countx)
)
(equal (memberList line1 (list countx county)) 1)
)
(princ "*")
(princ "-")
)
)
)
(setf countx (+ countx 1))
)
(setf countx xmin)
(write-line "")
(setf county (+ county 1))
)
(print "The triangle is draw!")
)
)
)
Which of operators can I past instead of princ and write-line?