Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,52 @@
|
|||
with(ArrayTools):
|
||||
|
||||
module Wheel()
|
||||
option object;
|
||||
local spokes := Array([1,2,3]);
|
||||
local currentSpoke := 1;
|
||||
|
||||
export currentValue::static := proc(self::Wheel)
|
||||
local valueOut;
|
||||
if type(self:-spokes[self:-currentSpoke], integer) then
|
||||
valueOut := self:-spokes[self:-currentSpoke]:
|
||||
else
|
||||
valueOut := currentValue(self:-spokes[self:-currentSpoke]):
|
||||
end if:
|
||||
rotate(self):
|
||||
return valueOut;
|
||||
end proc:
|
||||
|
||||
export rotate::static := proc(self::Wheel)
|
||||
if self:-currentSpoke = ArrayNumElems(self:-spokes) then self:-currentSpoke := 1:
|
||||
else self:-currentSpoke += 1: end if:
|
||||
end proc:
|
||||
|
||||
export ModuleApply::static := proc()
|
||||
Object(Wheel, _passed);
|
||||
end proc:
|
||||
|
||||
export ModuleCopy::static := proc(new::Wheel, proto::Wheel, spo::Array, curr::integer, $)
|
||||
new:-spokes := spo:
|
||||
new:-currentSpoke := curr:
|
||||
end proc:
|
||||
end module:
|
||||
|
||||
A := Wheel(Array([1,2,3]), 1):
|
||||
|
||||
seq(currentValue(A), 1..20);
|
||||
|
||||
A := Wheel(Array([1,B,2]), 1):
|
||||
B := Wheel(Array([3,4]), 1):
|
||||
|
||||
seq(currentValue(A), 1..20);
|
||||
|
||||
A := Wheel(Array([1,d,d]), 1):
|
||||
d := Wheel(Array([6,7,8]), 1):
|
||||
|
||||
seq(currentValue(A), 1..20);
|
||||
|
||||
A := Wheel(Array([1,b,C]), 1):
|
||||
b := Wheel(Array([3,4]), 1):
|
||||
C := Wheel(Array([5,b]), 1):
|
||||
|
||||
seq(currentValue(A), 1..20);
|
||||
Loading…
Add table
Add a link
Reference in a new issue