45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
Module Checkit {
|
|
Global a$
|
|
Document a$
|
|
Module Permutations (s){
|
|
Module Level (n, s, h) {
|
|
If n=1 then {
|
|
while Len(s) {
|
|
m1=each(h)
|
|
while m1 {
|
|
Print Array$(m1);" ";
|
|
}
|
|
Print Array$(S)
|
|
ToClipBoard()
|
|
s=cdr(s)
|
|
}
|
|
} Else {
|
|
for i=1 to len(s) {
|
|
call Level n-1, cdr(s), cons(h, car(s))
|
|
s=cons(cdr(s), car(s))
|
|
}
|
|
}
|
|
Sub ToClipBoard()
|
|
local m=each(h)
|
|
Local b$=""
|
|
While m {
|
|
b$+=If$(Len(b$)<>0->" ","")+Array$(m)+" "
|
|
}
|
|
b$+=If$(Len(b$)<>0->" ","")+Array$(s,0)+" "+{
|
|
}
|
|
a$<=b$ ' assign to global need <=
|
|
End Sub
|
|
}
|
|
If len(s)=0 then Error
|
|
Head=(,)
|
|
Call Level Len(s), s, Head
|
|
}
|
|
Clear a$
|
|
Permutations (1,2,3,4)
|
|
Permutations (100, 200, 500)
|
|
Permutations ("A", "B", "C","D")
|
|
Permutations ("DOG", "CAT", "BAT")
|
|
ClipBoard a$
|
|
}
|
|
Checkit
|