Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
procedure do_permute(l, i, n)
|
||||
if i >= n then
|
||||
return l
|
||||
else
|
||||
suspend l[i to n] <-> l[i] & do_permute(l, i+1, n)
|
||||
end
|
||||
|
||||
procedure permute(l)
|
||||
suspend do_permute(l, 1, *l)
|
||||
end
|
||||
|
||||
procedure sorted(l)
|
||||
local i
|
||||
if (i := 2 to *l & l[i] >= l[i-1]) then return &fail else return 1
|
||||
end
|
||||
|
||||
procedure main()
|
||||
local l
|
||||
l := [6,3,4,5,1]
|
||||
|( l := permute(l) & sorted(l)) \1 & every writes(" ",!l)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue