Skip to content

Instantly share code, notes, and snippets.

@DonaldKellett
Created December 22, 2018 09:56
Show Gist options
  • Save DonaldKellett/6812cc8594ce7433ef8b3be5f53426c2 to your computer and use it in GitHub Desktop.
Save DonaldKellett/6812cc8594ce7433ef8b3be5f53426c2 to your computer and use it in GitHub Desktop.
Learn Prolog Now! - Chapter 4 - Exercise 4.5 - Deutsch <-> English
% 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).
% listtran/2 - Given two lists G, E, is each element in G an exact translation in German of the corresponding English word in E? (Domain: 1-9 in German/English)
listtran([], []).
listtran([X | G], [Y | E]) :- tran(X, Y), listtran(G, E).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment