begin work on between library

This commit is contained in:
Mark Thom
2019-02-23 19:59:13 -07:00
parent 20b66e283f
commit 67ae47a01a
8 changed files with 83 additions and 49 deletions

View File

@@ -1,13 +1,14 @@
:- op(400, yfx, /).
:- module(builtins, [(=)/2, (+)/1, (+)/2, (**)/2, (*)/2, (-)/1, (-)/2,
(/)/2, (/\)/2, (\/)/2, (is)/2, (xor)/2, (div)/2, (//)/2,
(rdiv)/2, (<<)/2, (>>)/2, (mod)/2, (rem)/2, (>)/2, (<)/2,
(=\=)/2, (=:=)/2, (-)/1, (>=)/2, (=<)/2, (,)/2, (->)/2, (;)/2,
(=..)/2, (==)/2, (\==)/2, (@=<)/2, (@>=)/2, (@<)/2, (@>)/2,
(=@=)/2, (\=@=)/2, (:)/2, bagof/3, call_with_inference_limit/3,
catch/3, current_prolog_flag/2, expand_goal/2, expand_term/2,
findall/3, findall/4, set_prolog_flag/2, setof/3, setup_call_cleanup/3,
:- module(builtins, [(=)/2, (\=)/2, (\+)/1, (+)/1, (+)/2, (**)/2,
(*)/2, (-)/1, (-)/2, (/)/2, (/\)/2, (\/)/2, (is)/2, (xor)/2,
(div)/2, (//)/2, (rdiv)/2, (<<)/2, (>>)/2, (mod)/2, (rem)/2,
(>)/2, (<)/2, (=\=)/2, (=:=)/2, (-)/1, (>=)/2, (=<)/2, (,)/2,
(->)/2, (;)/2, (=..)/2, (==)/2, (\==)/2, (@=<)/2, (@>=)/2,
(@<)/2, (@>)/2, (=@=)/2, (\=@=)/2, (:)/2, bagof/3,
call_with_inference_limit/3, catch/3, current_prolog_flag/2,
expand_goal/2, expand_term/2, findall/3, findall/4, once/1,
repeat/0, set_prolog_flag/2, setof/3, setup_call_cleanup/3,
term_variables/2, throw/1, true/0, false/0, write/1,
write_canonical/1, writeq/1, write_term/2]).
@@ -44,7 +45,7 @@ expand_op_list([Op | OtherOps], Pred, Spec, [(:- op(Pred, Spec, Op)) | OtherResu
:- op(1100, xfy, ;).
% control.
:- op(700, xfx, [=, =..]).
:- op(700, xfx, [=, =.., \=]).
:- op(900, fy, \+).
% term comparison.
@@ -116,6 +117,17 @@ set_prolog_flag(Flag, _) :-
% control operators.
\+ G :- G, !, false.
\+ _.
X \= X :- !, false.
_ \= _.
once(G) :- G, !.
repeat.
repeat :- repeat.
','(G1, G2) :- '$get_b_value'(B), '$call_with_default_policy'(comma_errors(G1, G2, B)).
:- non_counted_backtracking comma_errors/3.
@@ -154,9 +166,6 @@ G1 -> G2 :- '$get_b_value'(B), '$call_with_default_policy'(->(G1, G2, B)).
% univ.
\+ G :- G, !, false.
\+ _.
:- non_counted_backtracking univ_errors/3.
univ_errors(Term, List, N) :-
'$skip_max_list'(N, -1, List, R),
@@ -363,9 +372,8 @@ throw(Ball) :- '$set_ball'(Ball), '$unwind_stack'.
truncate_lh_to(LhLength) :- '$truncate_lh_to'(LhLength).
check_for_compat_list(L, PI) :-
'$skip_max_list'(_, -1, L, R),
( nonvar(R), R \== [], throw(error(type_error(list, L), PI))
check_for_compat_list(L, PI) :-
( nonvar(L), L \= [_|_], throw(error(type_error(list, L), PI))
; true
).