.


:




:

































 

 

 

 


. 3.3. evenlength( List) eddlength( List)




3.3.
evenlength(List) eddlength(List)

, , , , , ( ). , (, , , d] evenlength, [ , , ]

oddlength.

3.4.
reverse! List, ReversedList }

, reverse ([ , , , d], [ d, , , ]).

3.5. palindrome (List). ,
,

[:i,, , , ].

3.6.

3. , , 85


shift(Listl, List2)

, List2 Listl " " . ,

- shift< [1,2,3,4,5), L1),

shift , L2).

;

L1 = [2,3,4,5,1] L2 - (3,4,5,1,2]

3.7.
translate; Listl, List2)

0 9 ,

, :

translate; [3,5,1,3], (three, five,one,three])

:

means (0, zero).

means (1, one).

means (2, two).

3.8.
subset! Set, Subset)

Set Subset , . , , , , :

?- subset ([a,b,c], S].

S = [,, ],-

S = [a,b];

S = [,];

S = [a];

S " [b,c] 1

S = [b];

3.9.

drvidelistf List, Listl, L^st2>

, List Listl List2, Listl List2 , dividelist ([ , , , d, ], [ , , ], [ , d]).

3.10. , 2, canget( State, Actions)

"yes" "", , , : Actions - [ walk (door, window), push (window, middle), climb, grasp] 3-11-

flatten (List, FlatList)

List , a FlatList List, "" , ( ) List , :?- flatten! (a,b, [c,d], [], t[[ej]],fj, L).

L = [ a, b, c, d, e, f]

86 I. Prolog






:


: 2015-10-01; !; : 474 |


:

:

, .
==> ...

1711 - | 1522 -


© 2015-2024 lektsii.org - -

: 0.009 .