fork download
  1. :- set_prolog_flag(verbose,silent).
  2. :- prompt(_, '').
  3. :- use_module(library(readutil)).
  4.  
  5. main:-
  6. process,
  7.  
  8. process:-
  9. read_line_to_codes(current_input, Codes),
  10. ( Codes = end_of_file
  11. -> true
  12. ; ( Codes \= [], number_codes(Int, Codes)
  13. -> (Int is 42
  14. -> true
  15. ; writeln(Int),
  16. process
  17. )
  18. ; true
  19. )
  20. ).
  21.  
  22. :- main.
Success #stdin #stdout 0.03s 6316KB
stdin
1
2
10
42
12
stdout
1
2
10