diff options
| author | Shinya Sato <shinnya.sato@gmail.com> | 2021-10-24 23:04:45 +0900 |
|---|---|---|
| committer | Shinya Sato <shinnya.sato@gmail.com> | 2021-10-24 23:04:45 +0900 |
| commit | 787dc13c837f0955fbd85b8f26a05d720d361333 (patch) | |
| tree | fec3abebb1e867e8b2239d7cf07b4c7d13ce0f81 /comparison/Inpla/src/bsort-40000-reuse.in | |
| parent | e607a57dfafb784c4e27da143214afb2ccd07fbf (diff) | |
| download | inpla-787dc13c837f0955fbd85b8f26a05d720d361333.tar.gz inpla-787dc13c837f0955fbd85b8f26a05d720d361333.zip | |
Upload the comparison directory
Diffstat (limited to 'comparison/Inpla/src/bsort-40000-reuse.in')
| -rw-r--r-- | comparison/Inpla/src/bsort-40000-reuse.in | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/comparison/Inpla/src/bsort-40000-reuse.in b/comparison/Inpla/src/bsort-40000-reuse.in new file mode 100644 index 0000000..8b6a386 --- /dev/null +++ b/comparison/Inpla/src/bsort-40000-reuse.in @@ -0,0 +1,24 @@ +// Bubble sort +BS(ret) >< [] => ret~[]; +BS(ret) >< x:xs => (*L)BS(ret)~cnt, (*R)B(cnt, x)~xs; +BS(ret) >< M(x) => ret~x; + +B(ret, int x) >< [] => ret~M([x]); +B(ret, int x) >< M(w) => ret~M(x:w); +B(ret, int x) >< (int y):ys +| x<y => ret~(*R)(x:cnt), (*L)B(cnt, y)~ys +| _ => ret~(*R)(y:cnt), (*L)B(cnt, x)~ys; + + + + +const LIST_ELEM=40000; + +MkRandList(ret) >< (int n) +| n>0 => ret~(rd:cnt), (*L)MkRandList(cnt)~(n-1) + where rd=rand(10000) +| _ => ret~[]; + +MkRandList(cnt)~(LIST_ELEM), +BS(ret)~cnt; +ret; |
