Welcome!


posted on April 9, 2021, 4:32 a.m.

Prolog stdin/stdout example:

:- initialization main, halt.

read_lines([H|T]) :-
  read_line_to_codes(user_input, H), H \= end_of_file, read_lines(T).
read_lines([]).

write_lines([]).
write_lines([H|T]) :-
  writef("%s\n", [H]), write_lines(T).

main :-
  read_lines(X), write_lines(X).

Comments

There are no comments at the moment.