Diff for ''
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| ipNMwY , [url=http://wzuszacqlmee.com/]wzuszacqlmee[/url], [link=http://hkflpbkpejrm.com/]hkflpbkpejrm[/link], http://rxoogzyjaycw.com/ | # uloha v prologu <{ForumPost(poster="msokol3", timestamp=2010-06-14 21:38:55)}> Ahoj. potreboval by som trochu helfnut s ulohou v prologu. potrebujem overit konecnu binarnu mnozinu, ci je antisymetricka a tranzitivna. ak mi niekto mozete pomoct, budem velmi rad. dakujem. <{/ForumPost}> <{ForumPost(poster="venca", timestamp=2010-06-15 17:40:10)}> co je binární množina? <{/ForumPost}> <{ForumPost(poster="msokol3", timestamp=2010-06-17 09:11:34)}> G(\[1,2],\[1,3]) napr. pre antisymetriu mam spracovany kod: antisym(\[]). antisym(\[\[X,Y]|R]):- najdi(\[Y,X],R, \[Y,X]),!,fail. antisym(\[\[X,Y]|R]):- antisym(R) najdi(A,\[A|_],A). najdi(A,\[B|S],Out):- najdi(A,S,Out). malo by to fungovat. akurat mam problem s tranzitivitou. <{/ForumPost}> <{ForumPost(poster="thc", timestamp=2010-06-20 21:49:48)}> > msokol3 wrote:G(\[1,2],\[1,3]) napr. > > pre antisymetriu mam spracovany kod: > > antisym(\[]). > antisym(\[\[X,Y]|R]):- > najdi(\[Y,X],R, \[Y,X]),!,fail. > antisym(\[\[X,Y]|R]):- > antisym(R) > > najdi(A,\[A|_],A). > najdi(A,\[B|S],Out):- > najdi(A,S,Out). > > malo by to fungovat. akurat mam problem s tranzitivitou. V ramci pripravy na zkousku (samozrejme bez zaruky): binary_set( [(1,1),(1,2),(3,3),(2,3)] ). non_member(X,[Y|T]) :- X \== Y, non_member(X,T). non_member(X,[]). antisymetrie([]). antisymetrie([(A,B)|XS]) :- A == B, antisymetrie(XS). antisymetrie([(A,B)|XS]) :- A \== B, non_member((B,A), XS), antisymetrie(XS). % binary_set(A),tranzitivita(A). tranzitivita([]). tranzitivita(XS) :- tranzitivita(XS, XS). tranzitivita([], _). tranzitivita([(A,B)|XS], YS) :- (member((B,C), YS) -> member((A,C), YS)), tranzitivita(XS, YS). <{/ForumPost}> <{ForumPost(poster="msokol3", timestamp=2010-06-22 20:19:49)}> diky moc za pomoc:) <{/ForumPost}> |