jack: (Default)
[personal profile] jack
I've also added arrays, so you can do:
# Warning, untested
fib = Arr(10,Var)
for a,b,c in fib.adj_objs(3):
 c = a + b
fib[0] = fib[1] = 1
assert fib == (1, 1, 2, 3, 5, 8, 13, 21, 34, 55)

graph = Arr(10,Point)
for x,(pt,f) in enumerate(zip(graph,fib)):
 pt.x = 10 * x
 pt.y = 150 - 2 * f
But I really wanted to give an alternative to the "for ... in" syntax, something like:
 fib_pts = Arr(10,Point)
 fib.each() = fib.prev() + fib.prev(2)
or maybe:
 fib[pyl.idx] = fib[pyl.idx-1] + fib[pyl.idx-2]
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org