fork download
  1. (defrule readin
  2. ?f<-(initial-fact)
  3. =>
  4. (retract ?f)
  5. (assert (number (read)))
  6. )
  7.  
  8. (defrule writeout
  9. ?f<-(number ?n)(test (<> ?n 42))
  10. =>
  11. (retract ?f)
  12. (printout t ?n crlf)
  13. (assert (initial-fact))
  14. )
  15.  
  16. (reset)
  17.  
  18. (run)
  19.  
  20. (exit)
  21. ; empty line at the end
Success #stdin #stdout 0s 5288KB
stdin
1
2
10
42
11
stdout
1
2
10