Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Fractran/Icon/fractran.icon
Normal file
27
Task/Fractran/Icon/fractran.icon
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
record fract(n,d)
|
||||
|
||||
procedure main(A)
|
||||
fractran("17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1", 2)
|
||||
end
|
||||
|
||||
procedure fractran(s, n, limit)
|
||||
execute(parse(s),n, limit)
|
||||
end
|
||||
|
||||
procedure parse(s)
|
||||
f := []
|
||||
s ? while not pos(0) do {
|
||||
tab(upto(' ')|0) ? put(f,fract(tab(upto('/')), (move(1),tab(0))))
|
||||
move(1)
|
||||
}
|
||||
return f
|
||||
end
|
||||
|
||||
procedure execute(f,d,limit)
|
||||
/limit := 15
|
||||
every !limit do {
|
||||
if d := (d%f[i := !*f].d == 0, (writes(" ",d)/f[i].d)*f[i].n) then {}
|
||||
else break write()
|
||||
}
|
||||
write()
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue