ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 386e710 was
17c6c1c3,
checked in by Peter A. Buhr <pabuhr@…>, 6 years ago
|
add more paper examples
|
-
Property mode set to
100644
|
File size:
418 bytes
|
Rev | Line | |
---|
[17c6c1c3] | 1 | def Recursion(): |
---|
| 2 | def Refactor(): |
---|
| 3 | N = (yield) |
---|
| 4 | print( N ); |
---|
| 5 | if N == 0: |
---|
| 6 | yield 0 |
---|
| 7 | r = Refactor() |
---|
| 8 | next( r ) |
---|
| 9 | x = r.send( N - 1 ) |
---|
| 10 | print( x ); |
---|
| 11 | yield x |
---|
| 12 | |
---|
| 13 | N = (yield) |
---|
| 14 | print( N ); |
---|
| 15 | r = Refactor() |
---|
| 16 | next( r ) |
---|
| 17 | print( r.send( N - 1 ) ) |
---|
| 18 | |
---|
| 19 | c = Recursion() |
---|
| 20 | next( c ) |
---|
| 21 | try: |
---|
| 22 | c.send( 5 ) |
---|
| 23 | except StopIteration: |
---|
| 24 | print( "stop" ) |
---|
| 25 | |
---|
| 26 | # Local Variables: # |
---|
| 27 | # tab-width: 4 # |
---|
| 28 | # compile-command: "python3.5 Refactor.py" # |
---|
| 29 | # End: # |
---|
Note: See
TracBrowser
for help on using the repository browser.