Add Papers Marked0
Paper checked off!

Marked works

Viewed0

Viewed works

Shopping Cart0
Paper added to shopping cart!

Shopping Cart

Register Now

internet library
Atlants.lv library
FAQ
1,99 € Add to cart
Add to Wish List
Want cheaper?
ID number:891265
 
Evaluation:
Published: 26.11.2007.
Language: Latvian
Level: College/University
Literature: n/a
References: Not used
Extract


a.daļa
Programmas teksts:
/* Predikāts, kas atrod saraksta garumu */
garums([],0):-!.
garums([_|T],S):-garums(T,S1), S is S1 + 1.

/* Predikāts, kas atrod saraksta lielāko elementu */
/* Ja saraksts ir tukšs, lielākais elements ir 0 */
max([],0):-!.
/* Salīdzinām katru saraksta elementu ar līdz šim lielāko atrasto elementu */
max([H|T],X):-maxEval(T,H,X).

/* Papildus predikāts, kas salīdzina saraksta elementus */
maxEval([H|T],X,X1):- H>=X, !, maxEval(T,H,X1).
maxEval([H|T],X,X1):- H maxEval([],X,X).


3. uzdevums

a(a(3,A,1),a(C,A,B),C)
a(Z,a(Y,b(3,2),X),a(2,5,Z))

{} a(3,A,1)=Z, a(C,A,B)=a(Y,b(3,2),X), C=a(2,5,Z)
{Z → a(3,A,1)}
a(C,A,B)=a(Y,b(3,2),X), C=a(2,5,a(3,A,1))
{Z → a(3,A,1)}…

Author's comment
Load more similar papers

Atlants

Choose Authorization Method

Email & Password

Email & Password

Wrong e-mail adress or password!
Log In

Forgot your password?

Draugiem.pase
Facebook

Not registered yet?

Register and redeem free papers!

To receive free papers from Atlants.com it is necessary to register. It's quick and will only take a few seconds.

If you have already registered, simply to access the free content.

Cancel Register