diff options
| author | Shinya Sato <shinnya.sato@gmail.com> | 2022-04-28 21:47:28 +0900 |
|---|---|---|
| committer | Shinya Sato <shinnya.sato@gmail.com> | 2022-04-28 21:47:28 +0900 |
| commit | 7ea48cd96551247ecc763a5e42404ffa3464d0b0 (patch) | |
| tree | fd1b63ab48d98a9243d3053522e17e31b9dc033f /comparison/Inpla/src/isort-40000.in | |
| parent | 950e2cb2184cb7ead93ba8df691a190598ed242f (diff) | |
| parent | 429543c748aaf81b2a4207318eb5a05259469b21 (diff) | |
| download | inpla-7ea48cd96551247ecc763a5e42404ffa3464d0b0.tar.gz inpla-7ea48cd96551247ecc763a5e42404ffa3464d0b0.zip | |
Merge branch 'develop'
Diffstat (limited to 'comparison/Inpla/src/isort-40000.in')
| -rw-r--r-- | comparison/Inpla/src/isort-40000.in | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/comparison/Inpla/src/isort-40000.in b/comparison/Inpla/src/isort-40000.in index 295f6f4..0e3ed32 100644 --- a/comparison/Inpla/src/isort-40000.in +++ b/comparison/Inpla/src/isort-40000.in @@ -1,6 +1,6 @@ // Insertion sort -IS(ret) >< [] => ret~[]; -IS(ret) >< x:xs => I(ret, x)~cnt, IS(cnt)~xs; +isort(ret) >< [] => ret~[]; +isort(ret) >< x:xs => I(ret, x)~cnt, isort(cnt)~xs; I(ret, int x) >< [] => ret~[x]; I(ret, int x) >< (int y):ys @@ -8,13 +8,31 @@ I(ret, int x) >< (int 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) +// creates a random list +make_RandList(ret) >< (int n) +| n>0 => ret~(rd:cnt), make_RandList(cnt)~(n-1) where rd=rand(10000) | _ => ret~[]; -MkRandList(cnt)~(LIST_ELEM), -IS(ret)~cnt; + +// validation checks +valid(ret) >< [] => ret~False; +valid(ret) >< x:xs => valid_Cons(ret,x)~xs; + +valid_Cons(ret, int x) >< [] => ret~True; +valid_Cons(ret, int x) >< (int y):ys +| x<=y => valid_Cons(ret,y)~ys +| _ => ret~False, Eraser~ys; + +// The `Eraser' is a built-in agent defined for any agents as follows: +//Eraser >< Alpha(a1, ..., a5) => Eraser~a1, ..., Eraser~a5; + + +// Main +const LIST_ELEM=40000; + +make_RandList(rndlist)~(LIST_ELEM), +isort(sorted)~rndlist, +valid(ret)~sorted; + ret; |
