Advertisement
logicmoo

Untitled

Aug 6th, 2015
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. replace_arg_fast(C,A,VAR,CC):- duplicate_term(C,CC),setarg(A,CC,VAR),!.
  2.  
  3. replace_arg(C,A,VAR,CC):-
  4.    C=..FARGS,
  5.    replace_nth(FARGS,A,VAR,FARGO),!,
  6.    CC=..FARGO.
  7. :-moo_hide_childs(replace_arg/4).
  8.  
  9. :-moo_hide_childs(replace_nth/4).
  10. replace_nth([],_,_,[]):- !.
  11. replace_nth([_|ARGO],0,VAR,[VAR|ARGO]):- !.
  12. replace_nth([T|FARGS],A,VAR,[T|FARGO]):-
  13.     A2 is A-1,replace_nth(FARGS,A2,VAR,FARGO).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement