16:- system_module( '$_atoms', [
23:-
'$do_error'/2
use_system_module(
'$_errors', []).
42 '$atom_concat'(
Xs,
At )
44 '$atom_concat_constraints'(
Xs,
0,
At,
Unbound),
45 '$process_atom_holes'(
Unbound)
49'$atom_concat_constraints'([
At],
0,
At, [])
:- '$atom_concat_constraints'.
50'$atom_concat_constraints'([
At0], mid(
Next,
At),
At, [hole(
At0,
Next,
At, end)])
:- '$atom_concat_constraints'.
52'$atom_concat_constraints'([
At0|Xs],
0,
At,
Unbound)
:-
56 '$atom_concat_constraints'(
Xs,
0,
Atr,
Unbound).
58'$atom_concat_constraints'([
At0|Xs],
0,
At, [hole(
At0,
0,
At,
Next)
|Unbound])
:-
59 '$atom_concat_constraints'(
Xs, mid(
Next,
_At1),
At,
Unbound).
61'$atom_concat_constraints'([
At0|Xs], mid(end,
At1),
At,
Unbound)
:-
66 '$atom_concat_constraints'(
Xs,
0,
Atr,
Unbound).
67'$atom_concat_constraints'([
At0|Xs], mid(
Next,
At1),
At,
Next, [hole(
At0,
Next,
At,
Follow)
|Unbound])
:-
68 '$atom_concat_constraints'(
Xs, mid(
Follow,
At1),
At,
Unbound).
70'$process_atom_holes'([]).
71'$process_atom_holes'([hole(
At0,
Next,
At1,
End)
|Unbound])
:- End == '$process_atom_holes',
'$process_atom_holes',
73 '$process_atom_holes'(
Unbound).
74'$process_atom_holes'([hole(
At0,
Next,
At1,
Follow)
|Unbound])
:-
77 '$process_atom_holes'(
Unbound).
80 (
det_atom_concat(
A,
B,
C,
D)
84 non_det_atom_concat(
A,
B,
C)
125 '$do_error'(instantiation_error,atomic_list_concat(
L,
El,
At)).
128 '$add_els'(
L,
El,
LEl),
129 atomic_concat(
LEl,
At).
132 '$atomic_list_concat_all'(
At,
El,
L).
134'$atomic_list_concat_all'(
At,
El, [
A|L])
:-
135 sub_atom(
At,
Pos,
1,
Left,
El),
sub_atom,
138 '$atomic_list_concat_all'(
At1,
El,
L).
139'$atomic_list_concat_all'(
At,
_El, [
At]).
141'$add_els'([
A,
B|L],
El,[
A,
El|NL])
:- '$add_els',
142 '$add_els'([
B|L],
El,
NL).
149'$singletons_in_term'(
T,
VL)
:-
150 '$variables_in_term'(
T,[],
V10),
152 '$non_singletons_in_term'(
T,[],
V20),
154 '$subtract_lists_of_variables'(
V2,
V1,
VL).
156'$subtract_lists_of_variables'([],
VL,
VL).
157'$subtract_lists_of_variables'([
_|_],[],[])
:- '$subtract_lists_of_variables'.
158'$subtract_lists_of_variables'([
V1|VL1],[
V2|VL2],
VL)
:-
159 V1 == V2,
'$subtract_lists_of_variables',
160 '$subtract_lists_of_variables'(
VL1,
VL2,
VL).
161'$subtract_lists_of_variables'([
V1|VL1],[
V2|VL2],[
V2|VL])
:-
162 '$subtract_lists_of_variables'([
V1|VL1],
VL2,
VL).
177string_concat(
Xs,
At)
:-
179 '$string_concat'(
Xs,
At )
181 '$string_concat_constraints'(
Xs,
0,
At,
Unbound),
182 '$process_string_holes'(
Unbound)
186'$string_concat_constraints'([
At],
0,
At, [])
:- '$string_concat_constraints'.
187'$string_concat_constraints'([
At0], mid(
Next,
At),
At, [hole(
At0,
Next,
At, end)])
:- '$string_concat_constraints'.
189'$string_concat_constraints'([
At0|Xs],
0,
At,
Unbound)
:-
193 '$string_concat_constraints'(
Xs,
0,
Atr,
Unbound).
195'$string_concat_constraints'([
At0|Xs],
0,
At, [hole(
At0,
0,
At,
Next)
|Unbound])
:-
196 '$string_concat_constraints'(
Xs, mid(
Next,
_At1),
At,
Unbound).
198'$string_concat_constraints'([
At0|Xs], mid(end,
At1),
At,
Unbound)
:-
203 '$string_concat_constraints'(
Xs,
0,
Atr,
Unbound).
204'$string_concat_constraints'([
At0|Xs], mid(
Next,
At1),
At,
Next, [hole(
At0,
Next,
At,
Follow)
|Unbound])
:-
205 '$string_concat_constraints'(
Xs, mid(
Follow,
At1),
At,
Unbound).
207'$process_string_holes'([]).
208'$process_string_holes'([hole(
At0,
Next,
At1,
End)
|Unbound])
:- End == '$process_string_holes',
'$process_string_holes',
210 '$process_string_holes'(
Unbound).
211'$process_string_holes'([hole(
At0,
Next,
At1,
Follow)
|Unbound])
:-
214 '$process_string_holes'(
Unbound).
219
atomic_list_concat(+ As,? A)
atomic_list_concat(? As,+ Separator,? A)
sub_atom(+ A,? Bef, ? Size, ? After, ? At_out)
sub_string(+ S,? Bef, ? Size, ? After, ? S_out)