Hope someone helps me there, because I cannot find a useful answer, and I am new to Lisp.
What I'm trying to do is check the value of one element and print something if it is 1, otherwise to print an empty character. This works when all the arguments to the list have a value of 1:
(defun print-lst (list)
(format t "~%~a ~a ~a~%"
(if (= (nth 0 list) '1)
'¦)
(if (= (nth 1 list) '1)
'P)
(if (= (nth 2 list) '1)
'¦)))
so the way out ¦ P ¦. But, if the second element in the list is 0, it prints NIL in this place ¦ NIL ¦, and I want it to print a space instead ¦ ¦(and not just to skip this character ¦¦, it is important that the empty character in this position in the output line if the tested value not equal to 1).
Is there a way to return a null character if the condition is (if (= (nth 1 list) '1) 'P)not met or is there another way to fulfill this? Hope I explained it beautifully. Thank.
source
share