Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -1,43 +1,42 @@
|
|||
Module StepByStep {
|
||||
Function PermutationStep (a) {
|
||||
c1=lambda (&f, a) ->{
|
||||
=car(a)
|
||||
f=true
|
||||
}
|
||||
m=len(a)
|
||||
c=c1
|
||||
while m>1 {
|
||||
c1=lambda c2=c,p, m=(,) (&f, a) ->{
|
||||
if len(m)=0 then m=a
|
||||
=cons(car(m),c2(&f, cdr(m)))
|
||||
if f then f=false:p++: m=cons(cdr(m), car(m)) : if p=len(m) then p=0 : m=(,):: f=true
|
||||
}
|
||||
c=c1
|
||||
m--
|
||||
}
|
||||
=lambda c, a (&f) -> {
|
||||
=c(&f, a)
|
||||
}
|
||||
}
|
||||
k=false
|
||||
StepA=PermutationStep((1,2,3,4))
|
||||
while not k {
|
||||
Print StepA(&k)
|
||||
}
|
||||
k=false
|
||||
StepA=PermutationStep((100,200,300))
|
||||
while not k {
|
||||
Print StepA(&k)
|
||||
}
|
||||
k=false
|
||||
StepA=PermutationStep(("A", "B", "C", "D"))
|
||||
while not k {
|
||||
Print StepA(&k)
|
||||
}
|
||||
k=false
|
||||
StepA=PermutationStep(("DOG", "CAT", "BAT"))
|
||||
while not k {
|
||||
Print StepA(&k)
|
||||
}
|
||||
Function PermutationStep {
|
||||
a=array([])
|
||||
c1=lambda (&f, a) ->{
|
||||
=car(a)
|
||||
f=true
|
||||
}
|
||||
m=len(a)
|
||||
c=c1
|
||||
while m>1
|
||||
c1=lambda c2=c, p, m=(,) (&f, a) ->{
|
||||
if len(m)=0 then m=a
|
||||
=cons(car(m),c2(&f, cdr(m)))
|
||||
if f then
|
||||
f=false
|
||||
p++
|
||||
m=cons(cdr(m), car(m))
|
||||
if p=len(m) then
|
||||
p=0
|
||||
m=(,)
|
||||
f=true
|
||||
end if
|
||||
end if
|
||||
}
|
||||
c=c1
|
||||
m--
|
||||
end while
|
||||
=lambda c, a (&f) -> {
|
||||
=c(&f, a)
|
||||
}
|
||||
}
|
||||
display(PermutationStep(1,2,3,4))
|
||||
display(PermutationStep(100,200,300))
|
||||
display(PermutationStep("A", "B", "C", "D"))
|
||||
display(PermutationStep("DOG", "CAT", "BAT"))
|
||||
|
||||
sub display(S as lambda)
|
||||
k=false
|
||||
while not k : Print S(&k)#str$(): end while
|
||||
end sub
|
||||
}
|
||||
StepByStep
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue