Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. change_heads(C1,C2,C1new,C2new,Simseq) :-
  2. int_format(C1,[Head1,Contx1,Spec1]),
  3. int_format(C2,[Head2,Contx2,Spec2]),
  4. extract_information_from_clause(C1,C2,Seq1,Cont1,Etq1,Seq2,Cont2,Etq2,T1,T2,R1_Out,R2_Out,H1,H2),
  5. write('EXTRACT FATTO'),
  6. match_sequences(Seq1,Seq2,Cont1,Cont2,matchLabelOn,Etq1,Etq2,1/3,1/3,1/3,Simseq,GenSeq),
  7. write('MATCH FATTO'),
  8. nl,write('GENSEQ: '),write(GenSeq),
  9. extract_sequences(GenSeq,SeqOut1,SeqOut2),
  10. %nl,write('SEQOUT1: '),write(SeqOut1),nl,write('SEQOUT2: '),write(SeqOut2),nl,
  11. (genSeqEmpty(GenSeq) ->
  12. C1new = [Head1,Contx1,Spec1],
  13. C2new = [Head2,Contx2,Spec2]
  14. ;
  15. dummy_predicate(SeqOut1,SeqOut2,Dummy1,Dummy2),
  16. Dummy1 =.. [Functor|Args1],
  17. Dummy2 =.. [Functor|Args2],
  18. pushHead(H1, Args1, Args1Out),
  19. pushHead(H2, Args2, Args2Out),
  20. nl, write('CONTX1'), write(Args1Out),
  21. nl, write('CONTX2'), write(Args2Out),
  22. create_predicate(Args1Out,DummyOut1),
  23. create_predicate(Args2Out,DummyOut2),
  24. C1new = [DummyOut1,Contx1,Spec1],
  25. C2new = [DummyOut2,Contx2,Spec2],
  26. !).
  27.  
  28. /* pushHead/3
  29. Inserisce l'Item in una lista, spostandolo nella testa della stessa lista
  30. */
  31. pushHead(Item, List, [Item|List]) :- !.
  32.  
  33. /*genSeqEmpty/1
  34. Controlla che tutti gli elementi della lista genSeq nel formato [X-[[]],...] siano vuoti
  35. */
  36. genSeqEmpty([X-[[]]]).
  37. genSeqEmpty([A-[[]]|B]):-
  38. genSeqEmpty(B).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement