Changeset e73d449


Ignore:
Timestamp:
Mar 22, 2019, 3:45:28 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
1097bb7, d4a60ac
Parents:
f8cd310
Message:

formatting

Location:
doc/papers/concurrency/examples
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/concurrency/examples/Fib.py

    rf8cd310 re73d449  
    1 def Fibonacci():
     1def Fib():
    22        fn = 0; fn1 = fn; yield fn  # suspend
    33        fn = 1; fn2 = fn1; fn1 = fn; yield fn
     
    77
    88
    9 f1 = Fibonacci()
    10 f2 = Fibonacci()
     9f1 = Fib()
     10f2 = Fib()
    1111for i in range( 10 ):
    1212        print( next( f1 ), next( f2 ) )  # resume
  • doc/papers/concurrency/examples/FibRefactor.py

    rf8cd310 re73d449  
    1 def Fibonacci():
     1def Fib():
    22        def Refactor():
    3                 nonlocal fn, fn1, fn2
     3                nonlocal fn, fn1
    44                fn = 0; fn1 = fn
    55                yield fn                                                # suspend
     6
    67        def Refactor2():
    78                nonlocal fn, fn1, fn2
     
    1415                fn = fn1 + fn2; fn2 = fn1; fn1 = fn; yield fn
    1516
    16 f1 = Fibonacci()
    17 f2 = Fibonacci()
     17f1 = Fib()
     18f2 = Fib()
    1819for i in range( 10 ):
    1920        print( next( f1 ), next( f2 ) )         # resume
  • doc/papers/concurrency/examples/Format.cc

    rf8cd310 re73d449  
    3131// Local Variables: //
    3232// tab-width: 4 //
    33 // fill-column: 120 //
    3433// compile-command: "u++-work -O2 -nodebubg Format.cc" //
    3534// End: //
Note: See TracChangeset for help on using the changeset viewer.