28.01.2015 Views

AI 08226 Prolog (PROgramming in LOGic) - Department of ...

AI 08226 Prolog (PROgramming in LOGic) - Department of ...

AI 08226 Prolog (PROgramming in LOGic) - Department of ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Prolog</strong> Syntax<br />

15<br />

Operators<br />

many built <strong>in</strong> b<strong>in</strong>ary and unary operators<br />

Arithmetic Infix { /, *, -,, +, // , mod}<br />

- A is 3+4*7.<br />

A = 31<br />

Arithmetic Prefix (unary) {truncate, floor, round}<br />

- A is round( 34/31).<br />

A = 1<br />

Cannot use variable name for more than one value<br />

- A is 3*5, A is A*5, A is sqrt(A).<br />

Need to use differently named variables<br />

- A1 is 3*5, A2 is A1*5, A3 is sqrt(A2).

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

Saved successfully!

Ooh no, something went wrong!