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