=====Das cut in Prolog===== Das Prädikat Ausrufezeichen (!) nennt man cut in Prolog. Es liefert immer true. Es unterbricht das Backtracking. http://www.tinohempel.de/info/info/datenbanken_prolog/cut.htm http://www.hsg-kl.de/faecher/inf/material/prolog/cut/index.php Ein einfaches Beispiel %%(smalltalk) bin1:-bin(B3), bin(B2), bin(B1), gibaus(B3,B2,B1). bin2:-bin(B3),!,bin(B2), bin(B1), gibaus(B3,B2,B1). bin3:-bin(B3), bin(B2),!,bin(B1), gibaus(B3,B2,B1). bin4:-bin(B3), bin(B2), bin(B1),!,gibaus(B3,B2,B1). bin(0). bin(1). gibaus(B3,B2,B1):- write(B3),write(B2),write(B1),nl. %% {{image url="images/prolog_cut.png"}} Das Prädikat bin1 ohne cut %%(smalltalk) ?- bin1. 000 true ; 001 true ; 010 true ; 011 true ; 100 true ; 101 true ; 110 true ; 111 true. %% Das Prädikat bin2 mit green cut (Cut 1 in der Abbildung) %%(smalltalk) ?- bin2. 000 true ; 001 true ; 010 true ; 011 true. %% Das Prädikat bin3 mit green cut (Cut 2 in der Abbildung) %%(smalltalk) ?- bin3. 000 true ; 001 true. %% Das Prädikat bin4 mit red cut (Cut 3 in der Abbildung) %%(smalltalk) ?- bin4. 000 true. %% ---- Siehe auch {{backlinks}}