30.01.2014 Views

Folien - Fachgruppe Informatik an der RWTH Aachen

Folien - Fachgruppe Informatik an der RWTH Aachen

Folien - Fachgruppe Informatik an der RWTH Aachen

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Imperative Program<br />

Logic Program<br />

• program = sequence of instructions<br />

class List {<br />

int hd; List tl;<br />

int len ()<br />

{<br />

List x = this;<br />

int n = 0;<br />

while (x != null) {<br />

• program = knowledge base<br />

• specifies what should be<br />

computed,<br />

not<br />

how it is computed<br />

len([], 0).<br />

len([HD|TL], N): -len(TL, M),<br />

N is M + 1.<br />

?- len([15,70,36], P).<br />

P = 3<br />

x = x.tl;<br />

n = n + 1; }<br />

Adv<strong>an</strong>tages<br />

• shorter <strong>an</strong>d clearer programs<br />

}<br />

}<br />

return n;<br />

• fast development<br />

• especially suitable for AI

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!