[[
✎ pl:prolog:pllib:list_odd-even
]]
aiWiki
Pokaż stronę
Ostatnie zmiany
Indeks
Zaloguj
Ta strona jest tylko do odczytu. Możesz wyświetlić źródła tej strony ale nie możesz ich zmienić.
====== List odd-even ====== {{tag>lists}} ===== Description ===== Learning about odd-length and even-length simultaneously. **Source**: PROLOG programming for artificial intelligence, 3rd Edition, Harlow, 2001, ISBN 0-201-40375-7. ===== Download ===== Program source code: {{list_odd-even.pl}} ===== Listing ===== <code prolog> % Figure 19.8 Learning about odd-length and even-length simultaneously. % Inducing odd and even length for lists backliteral( even( L), [ L:list], []). backliteral( odd( L), [ L:list], []). term( list, [X|L], [ X:item, L:list]). term( list, [], []). prolog_predicate( fail). start_clause([ odd( L) ] / [ L:list]). start_clause([ even( L) ] / [ L:list]). ex( even( [])). ex( even( [a,b])). ex( odd( [a])). ex( odd( [b,c,d])). ex( odd( [a,b,c,d,e])). ex( even( [a,b,c,d])). nex( even( [a])). nex( even( [a,b,c])). nex( odd( [])). nex( odd( [a,b])). nex( odd( [a,b,c,d])). </code> ===== Comments =====
pl/prolog/pllib/list_odd-even.txt
· ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
Pokaż stronę
Poprzednie wersje
Menadżer multimediów
Do góry