ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 33a484f was
17c6c1c3,
checked in by Peter A. Buhr <pabuhr@…>, 6 years ago
|
add more paper examples
|
-
Property mode set to
100644
|
File size:
272 bytes
|
Rev | Line | |
---|
[17c6c1c3] | 1 | def Fib(): |
---|
| 2 | fn1, fn = 0, 1 |
---|
| 3 | while True: |
---|
| 4 | yield fn1 |
---|
| 5 | fn1, fn = fn, fn1 + fn |
---|
| 6 | |
---|
| 7 | f1 = Fib() |
---|
| 8 | f2 = Fib() |
---|
| 9 | for i in range( 10 ): |
---|
| 10 | print( next( f1 ), next( f2 ) ) # resume |
---|
| 11 | |
---|
| 12 | # Local Variables: # |
---|
| 13 | # tab-width: 4 # |
---|
| 14 | # compile-command: "python3.5 Fib2.py" # |
---|
| 15 | # End: # |
---|
Note: See
TracBrowser
for help on using the repository browser.