Diff for ''
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| {| style="width: 20em; float: right; font-size: 95%; margin: 0 0 1em 1em; border: 1px solid #aaa; border-collapse: collapse; clear: right;" |- | style="padding: 0.5em; background: #cde; font-size: larger; border: 1px solid black;" | '''[[:Category:Předměty|{{{1}}}]]''' |- | {| style="margin-left: 1em;" |- style="vertical-align: top;" |Kód předmětu: |style="padding-left: 1em;" | [http://is.cuni.cz/studium/predmety/index.php?do=predmet&kod=N{{{3}}} N{{{3}}}] |- style="vertical-align: top;" |Přednáší: |style="padding-left: 1em;" | '''[[{{{2}}}]]''' |} |} |
# 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). |
| Line 17: | Line 67: |
| <{/ForumPost}> | |
| Line 18: | Line 69: |
| <{ForumPost(poster="msokol3", timestamp=2010-06-22 20:19:49)}> diky moc za pomoc:) <{/ForumPost}> |
|
| Line 19: | Line 73: |
[[Category:Předměty]] |