Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -1,41 +1,32 @@
|
|||
Module Checkit {
|
||||
Global a$
|
||||
Document a$
|
||||
Module Combinations (m as long, n as long){
|
||||
Function Combinations (m as long, n as long){
|
||||
Global a$
|
||||
Document a$
|
||||
Module Level (n, s, h) {
|
||||
If n=1 then {
|
||||
while Len(s) {
|
||||
Print h, car(s)
|
||||
ToClipBoard()
|
||||
If n=1 then
|
||||
while Len(s)
|
||||
a$<=h#str$("-")+"-"+car(s)#str$()+{
|
||||
}
|
||||
s=cdr(s)
|
||||
}
|
||||
} Else {
|
||||
While len(s) {
|
||||
End While
|
||||
Else
|
||||
While len(s)
|
||||
call Level n-1, cdr(s), cons(h, car(s))
|
||||
s=cdr(s)
|
||||
}
|
||||
}
|
||||
Sub ToClipBoard()
|
||||
local m=each(h)
|
||||
Local b$=""
|
||||
While m {
|
||||
b$+=If$(Len(b$)<>0->" ","")+Format$("{0::-10}",Array(m))
|
||||
}
|
||||
b$+=If$(Len(b$)<>0->" ","")+Format$("{0::-10}",Array(s,0))+{
|
||||
}
|
||||
a$<=b$ ' assign to global need <=
|
||||
End Sub
|
||||
End While
|
||||
End if
|
||||
}
|
||||
If m<1 or n<1 then Error
|
||||
s=(,)
|
||||
for i=0 to n-1 {
|
||||
s=cons(s, (i,))
|
||||
}
|
||||
for i=0 to n-1
|
||||
Append s, (i,)
|
||||
next
|
||||
s=s#sort()
|
||||
Head=(,)
|
||||
Call Level m, s, Head
|
||||
=a$
|
||||
}
|
||||
Clear a$
|
||||
Combinations 3, 5
|
||||
ClipBoard a$
|
||||
ClipBoard Combinations( 3, 5)
|
||||
report clipboard$
|
||||
}
|
||||
Checkit
|
||||
|
|
|
|||
|
|
@ -1,45 +1,55 @@
|
|||
Module StepByStep {
|
||||
Function CombinationsStep (a, nn) {
|
||||
c1=lambda (&f, &a) ->{
|
||||
=car(a) : a=cdr(a) : f=len(a)=0
|
||||
}
|
||||
m=len(a)
|
||||
Function CombinationsStep (a, nn) {
|
||||
c1=lambda (&f, &a) ->{
|
||||
=car(a) : a=cdr(a) : f=len(a)=0
|
||||
}
|
||||
m=len(a)
|
||||
c=c1
|
||||
n=m-nn+1
|
||||
p=2
|
||||
While m>n
|
||||
c1=lambda c2=c,n=p, z=(,) (&f, &m) ->{
|
||||
if len(z)=0 then z=cdr(m)
|
||||
=cons(car(m),c2(&f, &z))
|
||||
if f then z=(,) : m=cdr(m) : f=len(m)+len(z)<n
|
||||
}
|
||||
c=c1
|
||||
n=m-nn+1
|
||||
p=2
|
||||
while m>n {
|
||||
c1=lambda c2=c,n=p, z=(,) (&f, &m) ->{
|
||||
if len(z)=0 then z=cdr(m)
|
||||
=cons(car(m),c2(&f, &z))
|
||||
if f then z=(,) : m=cdr(m) : f=len(m)+len(z)<n
|
||||
}
|
||||
c=c1
|
||||
p++
|
||||
m--
|
||||
p++
|
||||
m--
|
||||
End While
|
||||
=lambda c, a (&f) -> {
|
||||
=c(&f, &a)
|
||||
}
|
||||
=lambda c, a (&f) -> {
|
||||
=c(&f, &a)
|
||||
}
|
||||
}
|
||||
k=false
|
||||
StepA=CombinationsStep((1, 2, 3, 4,5), 3)
|
||||
while not k {
|
||||
Print StepA(&k)
|
||||
}
|
||||
k=false
|
||||
StepA=CombinationsStep((0, 1, 2, 3, 4), 3)
|
||||
while not k {
|
||||
Print StepA(&k)
|
||||
}
|
||||
k=false
|
||||
StepA=CombinationsStep(("A", "B", "C", "D","E"), 3)
|
||||
while not k {
|
||||
Print StepA(&k)
|
||||
}
|
||||
k=false
|
||||
StepA=CombinationsStep(("CAT", "DOG", "BAT"), 2)
|
||||
while not k {
|
||||
Print StepA(&k)
|
||||
}
|
||||
}
|
||||
enum out {screen="", file="out.txt"}
|
||||
m=each(out)
|
||||
while m
|
||||
open eval(m) for output as #f
|
||||
k=false
|
||||
StepA=CombinationsStep((1, 2, 3, 4,5), 3)
|
||||
While not k
|
||||
Print #f, StepA(&k)#str$()
|
||||
End While
|
||||
Print #f
|
||||
k=false
|
||||
StepA=CombinationsStep((0, 1, 2, 3, 4), 3)
|
||||
While not k
|
||||
Print #f, StepA(&k)#str$()
|
||||
End While
|
||||
Print #f
|
||||
k=false
|
||||
StepA=CombinationsStep(("A", "B", "C", "D","E"), 3)
|
||||
While not k
|
||||
Print #f, StepA(&k)#str$("-")
|
||||
End While
|
||||
Print #f
|
||||
k=false
|
||||
StepA=CombinationsStep(("CAT", "DOG", "BAT"), 2)
|
||||
While not k
|
||||
Print #f, StepA(&k)#str$("-")
|
||||
End While
|
||||
close #f
|
||||
end while
|
||||
win "notepad", dir$+file
|
||||
}
|
||||
StepByStep
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue