Generator/Exponential: Difference between revisions
m
→{{header|M2000 Interpreter}}
Line 2,647:
<syntaxhighlight lang="m2000 interpreter">
Module Generator {
PowGen = Lambda (e)
e // closure
i++
Squares=Lambda
}▼
PowGen=PowGen(3) // closure
= PowGen()
}▼
Filter=Lambda
Squares, // closure
m, // closure
Cubes // closure
->{
while m<z :m=cubes():end while
if z=m then z=Squares()
= z : z=Squares()
}
▲ }
▲ Squares=lambda PowGen=PowGen(2) ->{
▲ =PowGen()
▲ }
▲ Cubes=Lambda PowGen=PowGen(3) -> {
▲ =PowGen()
▲ Filter=Lambda z=Squares(), Squares, m, Cubes->{
▲ while m<Z {m=cubes()}
▲ if z=m then z=Squares()
▲ =z
▲ z=Squares()
For i=1 to 20 : dropit=Filter() :Next i
Document doc$="Non-cubic squares (21st to 30th)"
Print doc$
▲ \\ a new line to doc$
doc$={
} \\ a new line to doc$
For i=1 to 10
f=Filter()
Print Format$("I: {0::-2}, F: {1}",i+20, f)
doc$=Format$("I: {0::-2}, F: {1}",i+20, f)+{
}
Clipboard doc$
}
|