prologiso-prologscryer-prolog

In scryer prolog, how do I provide stdin to `phrase_from_stream`?


It seems that the correct way to read user input in prolog is to use phrase_from_stream, providing stdin as the stream. How in Scryer Prolog does one bind a variable to the stdin stream in order to do this? i.e. I want to do something like

stdin(Input),
phrase_from_stream(my_phrase(X), Input).

Solution

  • Try the ISO predicate current_input(-Stream).