(deffunction preguntar-valor (?msg  ?tipo $?values)
    
(if (eq ?tipo symbol) then
    
(printout t ?msg $?values crlf)
(bind ?r (read))

(while (not (member$ ?r $?values))
do (printout t "No valida" crlf)
(printout t ?msg $?values)
(bind ?r (read)))

else (printout t ?msg   crlf)
(bind ?r (read))

(while (not (numberp ?r))
do (printout t "No valida" crlf)
(printout t ?msg  )
(bind ?r (read))))

(return ?r))
CLIPS> (preguntar-valor ("S1" number nil))