# Datové typy

## Seznam (list)

s:[1,4,9,16,25];

s[1];

s[1]:a;

s;

listp(s);

length(s);

makelist(i^2,i,1,5);

makelist(x=y,y,[a,b,c]);

create_list(x^i,i,[1,3,7]);

member(2,s);

member(1,s);

first(s);second(s);third(s);fourth(s);fifth(s);

last(s);

delete (y, [w, x, y, z, z, y, x, w]);

seznam:[x, x, x*y, x*(x-1)];

Odstranění duplicit

unique(seznam);

cl : [black, red, green, yellow, blue, white, pink];

rest(cl,2);

rest(cl,-2);

rest(cl);

reverse(cl);

cons(orange,cl);

endcons(orange,cl);

append(cl,[orange]);

L1:[1,2,3,4,5];

L2:[a,b,c,d,e];

join(L1,L2);

f(x):=x^2;

map(f,L1);

Sečtení prvků seznamu

apply("+",L1);

## Množina (set)

M1:set(b,a,c);

M1:{c,b,a};

setp(M1);

subst(c=a, M1);

M2:set(1,2,3);

M3:[1,1,2,2,3,3];

M4:setify(M3);

listify(M4);

full_listify ({a, b, {c, {d, e, f}, g}});

listify ({a, b, {c, {d, e, f}, g}});

fullsetify ([a, [a]]);

union(M1,M2);

intersect(M1,M2);

setdifference({0,1,2,3},{0,2,4,6});

cardinality(M1);

s:{1,2,five,3,4};

adjoin(x, s);

union(s,{x});

disjoin(x,%);

disjointp ({a, b, c}, {1, 2, 3});

disjointp ({a, b, 3}, {1, 2, 3});

elementp(1,s);

elementp(6,s);

collection:powerset({1,2,3});

cardinality(collection);

fourth(collection);

numbers:{0,%pi,%pi/3,%pi/2};

map(g,numbers);

map(sin, numbers);

setequalp ({1, 2, 3}, {1, 2, 3});

setequalp ({a, b, c}, {1, 2, 3});

subset ({1, 2, 7, 8, 9, 14}, evenp);

evenp(1);evenp(1/2);evenp(2);

subsetp ({1, 2, 3}, {a, 1, b, 2, c, 3});

subsetp ({a, 1, b, 2, c, 3}, {1, 2, 3});

## Pole (array)

array(A,2,3);

A[1,1]:1;A[1,2]:4;A[1,3]:9;

A[2,1]:1;A[2,2]:8;A[2,3]:27;

arrayinfo(A);

listarray (A);

## Matice

B:matrix([1,2,3],[1,4,9],[1,8,27]);

B[1,1];

C:transpose(B);

B.C;

Počet řádků

length(B);

Počet sloupců

length(transpose(B));

rank(B);

determinant(B);

invert(B);

B.%;