% while others can be set with `set_prolog_flag/2`.
%
% The flags that Scryer Prolog support are:
-%
+%
% * `max_arity`: The max arity a predicate can have in Prolog. On Scryer is set to 1023. Read only.
% * `bounded`: `true` if integer arithmethic is bounded between some min/max values. On Scryer is always set
% to `false` since it supports unbounded integer arithmethic. Read only.
%% set_prolog_flag(Flag, Value).
%
% Sets the internal value of the flag. To see the list of flags supported by Scryer Prolog,
-% check `current_prolog_flag/2`. The flags that are read only will fail if you try to change their values
+% check `current_prolog_flag/2`. The flags that are read only will fail if you try to change their values
set_prolog_flag(Flag, Value) :-
(var(Flag) ; var(Value)),
throw(error(instantiation_error, set_prolog_flag/2)). % 8.17.1.3 a, b
parse_options_list(Options, builtins:parse_read_term_options_, DefaultOptions, OptionValues, Stub).
-parse_read_term_options_(singletons(Vars), singletons-Vars) :-
- ( ( var(Vars)
- ; '$skip_max_list'(_, _, Vars, Rs),
- Rs == []
- ) ->
- !
- ; throw(error(domain_error(read_option, singletons(Vars)), read_term/2))
- ).
-parse_read_term_options_(variables(Vars), variables-Vars) :-
- ( ( var(Vars)
- ; '$skip_max_list'(_, _, Vars, Rs),
- Rs == []
- ) ->
- !
- ; throw(error(domain_error(read_option, variables(Vars)), read_term/2))
- ).
-parse_read_term_options_(variable_names(Vars), variable_names-Vars) :-
- ( ( var(Vars)
- ; '$skip_max_list'(_, _, Vars, Rs),
- Rs == []
- ) ->
- !
- ; throw(error(domain_error(read_option, variable_names(Vars)), read_term/2))
- ).
+parse_read_term_options_(singletons(Vars), singletons-Vars) :- !.
+parse_read_term_options_(variables(Vars), variables-Vars) :- !.
+parse_read_term_options_(variable_names(Vars), variable_names-Vars) :- !.
parse_read_term_options_(E,_) :-
throw(error(domain_error(read_option, E), _)).
% Read Term from the stream Stream. It supports several options:
% * `variables(-Vars)` unifies Vars with a list of variables in the term. Similar to do `term_variables/2` with the new term.
% * `variable_names(-Vars)` unifies Vars with a list `Name=Var` with Name describing the variable name and Var the variable itself that appears in Term.
-% * `singletons` similar to `variable_names` but only reports variables occurring only once in Term.
+% * `singletons` similar to `variable_names` but only reports variables occurring only once in Term.
read_term(Stream, Term, Options) :-
parse_read_term_options(Options, [Singletons, VariableNames, Variables], read_term/3),
'$read_term'(Stream, Term, Singletons, Variables, VariableNames).
%% sub_atom(+Atom, ?Before, ?Length, ?After, ?SubAtom).
%
% Relates an atom to a subatom inside with some key properties:
-%
+%
% * SubAtom starts at Before characters (0-based) from Atom
% * SubAtom has Length characters
% * After SubAtom there are After characters in Atom