I am trying to write some predicates to solve the following problem (learnprolognow.com)
Suppose we are given a knowledge base with the following facts:
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).
Write a predicate listtran (G, E) that translates a list of German number words into the corresponding list of English words. For instance:
listtran([eins,neun,zwei],X).
should give:
X = [one,nine,two].
I wrote:
listtran(G,E):- G=[], E=[]. listtran(G,E):- G=[First|T], tran(First, Mean), listtran(T, Eng), E = [Mean|Eng).
But I get the error: "illegal term start" when compiling. Any suggestions?
source share