Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.56 KB | None | 0 0
  1. head_tail(Str, Head, Tail) :-
  2.     sub_string(Str, 0, 1, _, Head),
  3.     string_concat(Head, Tail, Str).
  4.  
  5. iintersecta("", _, _) :-
  6.     !, fail.
  7. iintersecta(AS, BS, Inter) :-
  8.     string_concat(AS, _, BS),
  9.     string_length(AS, L), L >= 4,
  10.     Inter = BS.
  11. iintersecta(AAS, BS, Inter) :-
  12.     head_tail(AAS, A, AS),
  13.     iintersecta(AS, BS, IInter),
  14.     string_concat(A, IInter, Inter). % head_tail(Inter, A, IInter)
  15.  
  16. intersecta(AS, BS, Inter) :-
  17.     iintersecta(AS, BS, Inter), !.
  18. intersecta(AS, BS, Inter) :-
  19.     iintersecta(BS, AS, Inter), !.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement