Guest User

Untitled

a guest
Jul 8th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.36 KB | None | 0 0
  1. addall_s( Elem, Goal, Old, New ) :-
  2.   addall_s( Elem, Goal, Old, Old, [], New ).
  3.  
  4. addall_s( Elem, Goal, Old, Acc, Used, New ) :-
  5.   Goal =.. [Predicate|Arguments],
  6.   replace( Arguments, NewArguments, Elem, NewElem ),
  7.   NewGoal =.. [Predicate|NewArguments],
  8.   call(Goal),
  9.   \+member( Elem, Used ),!,
  10.   addall_s( NewElem, NewGoal, Old, [Elem|Acc], [Elem|Used], New ).
Add Comment
Please, Sign In to add comment