fix more conformity errors

This commit is contained in:
Mark Thom
2019-04-06 17:44:04 -06:00
parent 16eadc7412
commit fb0b7085b4
7 changed files with 182 additions and 81 deletions

View File

@@ -9,12 +9,12 @@
abolish/1, asserta/1, assertz/1, atom_chars/2, atom_codes/2,
atom_length/2, bagof/3, bb_b_put/2, bb_get/2, bb_put/2,
call_cleanup/2, call_with_inference_limit/3, catch/3,
clause/2, current_predicate/1, current_op/3,
char_code/2, clause/2, current_predicate/1, current_op/3,
current_prolog_flag/2, expand_goal/2, expand_term/2,
findall/3, findall/4, halt/0, once/1, op/3, repeat/0,
retract/1, 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]).
findall/3, findall/4, get_char/1, halt/0, once/1, op/3,
repeat/0, retract/1, 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]).
/* this is an implementation specific declarative operator used to implement call_with_inference_limit/3
and setup_call_cleanup/3. switches to the default trust_me and retry_me_else. Indexing choice
@@ -816,7 +816,7 @@ no_var_in_list([]).
no_var_in_list([X|Xs]) :- var(X), !, '$fail'.
no_var_in_list([_|Xs]) :- no_var_in_list(Xs).
atom_chars(Atom, List) :-
atom_chars(Atom, List) :-
( var(Atom) ->
( var(List) -> throw(error(instantiation_error, atom_chars/2))
; can_be_list(List, atom_chars/3), no_var_in_list(List) -> '$atom_chars'(Atom, List)
@@ -825,7 +825,7 @@ atom_chars(Atom, List) :-
; throw(error(type_error(atom, Atom), atom_chars/2))
).
atom_codes(Atom, List) :-
atom_codes(Atom, List) :-
( var(Atom) ->
( var(List) -> throw(error(instantiation_error, atom_codes/2))
; can_be_list(List, atom_codes/3), no_var_in_list(List) -> '$atom_codes'(Atom, List)
@@ -833,3 +833,19 @@ atom_codes(Atom, List) :-
; atom(Atom) -> '$atom_codes'(Atom, List)
; throw(error(type_error(atom, Atom), atom_codes/2))
).
char_code(Char, Code) :-
( var(Char) ->
( var(Code) -> throw(error(instantiation_error, char_code/2))
; integer(Code) -> '$char_code'(Char, Code)
; throw(error(type_error(integer, Code), char_code/2))
)
; atom_length(Char, 1) -> '$char_code'(Char, Code)
; throw(error(type_error(character, Char), char_code/2))
).
get_char(C) :-
( var(C) -> '$get_char'(C)
; atom_length(C, 1) -> '$get_char'(C)
; throw(error(type_error(in_character, C), get_char/1))
).