RosettaCodeData/Task/Fractran/11l/fractran.11l

13 lines
377 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
F fractran(prog, =val, limit)
V fracts = prog.split( ).map(p -> p.split(/).map(i -> Int(i)))
[Float] r
L(n) 0 .< limit
r [+]= val
L(p) fracts
I val % p[1] == 0
val = p[0] * val / p[1]
L.break
R r
print(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, 15))