fork download
  1. (deffunction preguntar-valor (?msg ?tipo $?values)
  2.  
  3. (if (eq ?tipo symbol) then
  4.  
  5. (printout t ?msg $?values crlf)
  6. (bind ?r (read))
  7.  
  8. (while (not (member$ ?r $?values))
  9. do (printout t "No valida" crlf)
  10. (printout t ?msg $?values)
  11. (bind ?r (read)))
  12.  
  13. else (printout t ?msg crlf)
  14. (bind ?r (read))
  15.  
  16. (while (not (numberp ?r))
  17. do (printout t "No valida" crlf)
  18. (printout t ?msg )
  19. (bind ?r (read))))
  20.  
  21. (return ?r))
  22. CLIPS> (preguntar-valor ("S1" number nil))
Runtime error #stdin #stdout 0.02s 3068KB
stdin
Standard input is empty
stdout
Standard output is empty