all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 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