This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swap12([X, Y | T], [Y, X | T]). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Deutsch <-> English translation of 1-9 (provided) | |
tran(eins,one). | |
tran(zwei,two). | |
tran(drei,three). | |
tran(vier,four). | |
tran(fuenf,five). | |
tran(sechs,six). | |
tran(sieben,seven). | |
tran(acht,eight). | |
tran(neun,nine). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
twice([], []). | |
twice([X | L1], [X, X | L2]) :- twice(L1, L2). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
combine1([], [], []). | |
combine1([X | L1], [Y | L2], [X, Y | Result]) :- combine1(L1, L2, Result). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
combine2([], [], []). | |
combine2([X | L1], [Y | L2], [[X, Y] | Result]) :- combine2(L1, L2, Result). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
combine3([], [], []). | |
combine3([X | L1], [Y | L2], [j(X, Y) | Result]) :- combine3(L1, L2, Result). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
increment(X, Y) :- Y is X + 1. | |
sum(X, Y, Z) :- Z is X + Y. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addone([], []). | |
addone([X | L0], [Y | L1]) :- Y is X + 1, addone(L0, L1). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
accMin([H | T], A, Result) :- H < A, accMin(T, H, Result). | |
accMin([H | T], A, Result) :- H >= A, accMin(T, A, Result). | |
accMin([], A, A). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalarMult(_, [], []). | |
scalarMult(C, [X | T], [Y | Result]) :- Y is C * X, scalarMult(C, T, Result). |