0
1) 사용자 입력이 예/아니오가 아닌 경우 질문을 반복하는 방법이 필요합니까?CLIPS 프로그래밍이 필요함
2) CLIPS가 작은 대문자를 허용 할 수있는 방법이 필요합니다.
Google 검색으로이 샘플을 찾았지만 특정 라인에서 어떻게 작동하는지 잘 모르겠습니다. 아무도 내게 어떻게 작동하는지 설명 할 수 있습니까? 아니면 필요한 두 가지를 모두 할 수있는 더 나은 방법이 있습니다.
(deffunction ask-question (?question $?allowed-values)
(printout t ?question)
(bind ?answer (read))
(if (lexemep ?answer)
then (bind ?answer (lowcase ?answer)))
(while (not (member ?answer ?allowed-values)) do
(printout t ?question)
(bind ?answer (read))
(if (lexemep ?answer)
then (bind ?answer (lowcase ?answer))))
?answer)
(deffunction yes-or-no-p (?question)
(bind ?response (ask-question ?question yes no y n))
(if (or (eq ?response yes) (eq ?response y))
then yes
else no))