Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for read/2 #2698

Merged
merged 2 commits into from
Dec 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lib/builtins.pl
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,10 @@
read_term(Stream, Term, []).
% read(Stream, Term).

%% read(+Stream, -Term).
%
% Read Term from the stream Stream with default options. **NOTE** This is not a general predicate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the phrasing "not a general predicate": Maybe this should instead clarify: "This predicate reads Prolog terms; for more general input, use for example phrase_from_file/2 or phrase_from_stream/2."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that read/2 is just here for convenience, it is a thin wrapper around read_term/3 with default options. So for me IMHO this description would be enough: "Same as read_term/3 with all default options".

% to read input from a file or the user. Use other predicates like `phrase_from_file/2` for that.
read(Stream, Term) :-
read_term(Stream, Term, []).

Expand Down
Loading