<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dw="https://www.dreamwidth.org">
  <id>tag:dreamwidth.org,2009-04-14:61366</id>
  <title>jack</title>
  <subtitle>jack</subtitle>
  <author>
    <name>jack</name>
  </author>
  <link rel="alternate" type="text/html" href="https://jack.dreamwidth.org/"/>
  <link rel="self" type="text/xml" href="https://jack.dreamwidth.org/data/atom"/>
  <updated>2012-07-31T12:06:35Z</updated>
  <dw:journal username="jack" type="personal"/>
  <entry>
    <id>tag:dreamwidth.org,2009-04-14:61366:773188</id>
    <link rel="alternate" type="text/html" href="https://jack.dreamwidth.org/773188.html"/>
    <link rel="self" type="text/xml" href="https://jack.dreamwidth.org/data/atom/?itemid=773188"/>
    <title>Pylogram arrays</title>
    <published>2012-07-31T12:04:47Z</published>
    <updated>2012-07-31T12:06:35Z</updated>
    <category term="tech"/>
    <category term="pylogram"/>
    <category term="array"/>
    <dw:security>public</dw:security>
    <dw:reply-count>0</dw:reply-count>
    <content type="html">I've also added arrays, so you can do:&lt;br /&gt;&lt;pre&gt;
# 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&lt;/pre&gt;But I really wanted to give an alternative to the "for ... in" syntax, something like:&lt;br /&gt;&lt;pre&gt;
 fib_pts = Arr(10,Point)
 fib.each() = fib.prev() + fib.prev(2)&lt;/pre&gt;or maybe:&lt;br /&gt;&lt;pre&gt;
 fib[pyl.idx] = fib[pyl.idx-1] + fib[pyl.idx-2]
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=jack&amp;ditemid=773188" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
</feed>
