aboutsummaryrefslogtreecommitdiff
path: root/comparison/Inpla/src/isort-40000.in
blob: 295f6f40cdd03276a095e4de1461c1f961ad1f4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Insertion sort
IS(ret) >< [] => ret~[];
IS(ret) >< x:xs => I(ret, x)~cnt, IS(cnt)~xs;

I(ret, int x) >< [] => ret~[x];
I(ret, int x) >< (int y):ys
| x<=y => ret~(x:y:ys)
| _    => ret~(y:cnt), I(cnt, x)~ys;


const LIST_ELEM=40000;

MkRandList(ret) >< (int n)
| n>0 => ret~(rd:cnt), MkRandList(cnt)~(n-1) 
  where rd=rand(10000)
| _ => ret~[];

MkRandList(cnt)~(LIST_ELEM),
IS(ret)~cnt;
ret;