distribution is now named through its structure, not just the main functor.
This commit is contained in:
parent
922424abd0
commit
d1db0d68ea
@ -90,12 +90,10 @@ dist(V, Id, Key, Parents) :-
|
||||
var(Key), !,
|
||||
when(Key, dist(V, Id, Key, Parents)).
|
||||
dist(p(Type, CPT), Id, Key, FParents) :-
|
||||
functor(Key, Na, Ar),
|
||||
functor(Key0, Na, Ar),
|
||||
copy_structure(Key, Key0),
|
||||
distribution(Type, CPT, Id, Key0, [], FParents).
|
||||
dist(p(Type, CPT, Parents), Id, Key, FParents) :-
|
||||
functor(Key, Na, Ar),
|
||||
functor(Key0, Na, Ar),
|
||||
copy_structure(Key, Key0),
|
||||
distribution(Type, CPT, Id, Key0, Parents, FParents).
|
||||
|
||||
dist_unbound(V, ground(V)) :-
|
||||
@ -238,3 +236,15 @@ dist_new_table(Id, NewMat) :-
|
||||
fail.
|
||||
dist_new_table(_, _).
|
||||
|
||||
copy_structure(V, V) :- var(V), !.
|
||||
copy_structure(V, _) :- primitive(V), !.
|
||||
copy_structure(Key, Key0) :-
|
||||
Key =.. [A|LKey],
|
||||
copy_Lstructure(LKey, LKey0),
|
||||
Key0 =.. [A|LKey0].
|
||||
|
||||
copy_Lstructure([], []).
|
||||
copy_Lstructure([H|LKey], [NH|LKey0]) :-
|
||||
copy_structure(H, NH),
|
||||
copy_Lstructure(LKey, LKey0).
|
||||
|
||||
|
Reference in New Issue
Block a user