Index: doc/papers/concurrency/Paper.tex
===================================================================
--- doc/papers/concurrency/Paper.tex	(revision ae6b6cf796a0f3fdf820aab4c5ad66768ec6d9cb)
+++ doc/papers/concurrency/Paper.tex	(revision 2fabdc0253be63e4524fc9b7dd87d64721f61dd9)
@@ -654,20 +654,43 @@
 \centering
 \newbox\myboxA
+% \begin{lrbox}{\myboxA}
+% \begin{cfa}[aboveskip=0pt,belowskip=0pt]
+% `int fn1, fn2, state = 1;`   // single global variables
+% int fib() {
+% 	int fn;
+% 	`switch ( state )` {  // explicit execution state
+% 	  case 1: fn = 0;  fn1 = fn;  state = 2;  break;
+% 	  case 2: fn = 1;  fn2 = fn1;  fn1 = fn;  state = 3;  break;
+% 	  case 3: fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;  break;
+% 	}
+% 	return fn;
+% }
+% int main() {
+% 
+% 	for ( int i = 0; i < 10; i += 1 ) {
+% 		printf( "%d\n", fib() );
+% 	}
+% }
+% \end{cfa}
+% \end{lrbox}
 \begin{lrbox}{\myboxA}
 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
-`int fn1, fn2, state = 1;`   // single global variables
-int fib() {
-	int fn;
-	`switch ( state )` {  // explicit execution state
-	  case 1: fn = 0;  fn1 = fn;  state = 2;  break;
-	  case 2: fn = 1;  fn2 = fn1;  fn1 = fn;  state = 3;  break;
-	  case 3: fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;  break;
-	}
-	return fn;
-}
+#define FIB_INIT { 0, 1 }
+typedef struct { int fn1, fn; } Fib;
+int fib( Fib * f ) {
+
+	int ret = f->fn1;
+	f->fn1 = f->fn;
+	f->fn = ret + f->fn;
+	return ret;
+}
+
+
+
 int main() {
-
+	Fib f1 = FIB_INIT, f2 = FIB_INIT;
 	for ( int i = 0; i < 10; i += 1 ) {
-		printf( "%d\n", fib() );
+		printf( "%d %d\n",
+				fib( &f1 ), fib( &f2 ) );
 	}
 }
@@ -678,72 +701,106 @@
 \begin{lrbox}{\myboxB}
 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
-#define FIB_INIT `{ 0, 1 }`
-typedef struct { int fn2, fn1; } Fib;
-int fib( Fib * f ) {
-
-	int ret = f->fn2;
-	int fn = f->fn1 + f->fn2;
-	f->fn2 = f->fn1; f->fn1 = fn;
-
-	return ret;
-}
-int main() {
-	Fib f1 = FIB_INIT, f2 = FIB_INIT;
-	for ( int i = 0; i < 10; i += 1 ) {
-		printf( "%d %d\n", fib( &fn1 ), fib( &f2 ) );
+`coroutine` Fib { int fn1; };
+void main( Fib & fib ) with( fib ) {
+	int fn;
+	[fn1, fn] = [0, 1];
+	for () {
+		`suspend();`
+		[fn1, fn] = [fn, fn1 + fn];
 	}
 }
-\end{cfa}
-\end{lrbox}
-
-\subfloat[3 states: global variables]{\label{f:GlobalVariables}\usebox\myboxA}
-\qquad
-\subfloat[1 state: encapsulated variables]{\label{f:ExternalState}\usebox\myboxB}
-\caption{C fibonacci fsm}
-\label{f:C-fibonacci}
-
-\bigskip
-
-\newbox\myboxA
-\begin{lrbox}{\myboxA}
-\begin{cfa}[aboveskip=0pt,belowskip=0pt]
-`coroutine` Fib { int fn; };
-void main( Fib & fib ) with( fib ) {
-	fn = 0;  int fn1 = fn; `suspend()`;
-	fn = 1;  int fn2 = fn1;  fn1 = fn; `suspend()`;
-	for () {
-		fn = fn1 + fn2; fn2 = fn1; fn1 = fn; `suspend()`; }
-}
-int next( Fib & fib ) with( fib ) { `resume( fib );` return fn; }
+int ?()( Fib & fib ) with( fib ) {
+	`resume( fib );`  return fn1;
+}
 int main() {
 	Fib f1, f2;
-	for ( 10 )
-		sout | next( f1 ) | next( f2 );
-}
+	for ( 10 ) {
+		sout | f1() | f2();
+}
+
+
 \end{cfa}
 \end{lrbox}
-\newbox\myboxB
-\begin{lrbox}{\myboxB}
+
+\newbox\myboxC
+\begin{lrbox}{\myboxC}
 \begin{python}[aboveskip=0pt,belowskip=0pt]
 
-def Fibonacci():
-	fn = 0;	fn1 = fn; `yield fn`  # suspend
-	fn = 1; fn2 = fn1; fn1 = fn; `yield fn`
-	while True:
-		fn = fn1 + fn2; fn2 = fn1; fn1 = fn; `yield fn`
-
-
-f1 = Fibonacci()
-f2 = Fibonacci()
+def Fib():
+
+    fn1, fn = 0, 1
+    while True:
+        `yield fn1`
+        fn1, fn = fn, fn1 + fn
+
+
+// next prewritten
+
+
+f1 = Fib()
+f2 = Fib()
 for i in range( 10 ):
-	print( `next( f1 )`, `next( f2 )` ) # resume
+	print( next( f1 ), next( f2 ) )
+
+
 
 \end{python}
 \end{lrbox}
-\subfloat[\CFA]{\label{f:Coroutine3States}\usebox\myboxA}
-\qquad
-\subfloat[Python]{\label{f:Coroutine1State}\usebox\myboxB}
-\caption{Fibonacci input coroutine, 3 states, internal variables}
-\label{f:cfa-fibonacci}
+
+\subfloat[C]{\label{f:GlobalVariables}\usebox\myboxA}
+\hspace{3pt}
+\vrule
+\hspace{3pt}
+\subfloat[\CFA]{\label{f:ExternalState}\usebox\myboxB}
+\hspace{3pt}
+\vrule
+\hspace{3pt}
+\subfloat[Python]{\label{f:ExternalState}\usebox\myboxC}
+\caption{Fibonacci Generator}
+\label{f:C-fibonacci}
+
+% \bigskip
+% 
+% \newbox\myboxA
+% \begin{lrbox}{\myboxA}
+% \begin{cfa}[aboveskip=0pt,belowskip=0pt]
+% `coroutine` Fib { int fn; };
+% void main( Fib & fib ) with( fib ) {
+% 	fn = 0;  int fn1 = fn; `suspend()`;
+% 	fn = 1;  int fn2 = fn1;  fn1 = fn; `suspend()`;
+% 	for () {
+% 		fn = fn1 + fn2; fn2 = fn1; fn1 = fn; `suspend()`; }
+% }
+% int next( Fib & fib ) with( fib ) { `resume( fib );` return fn; }
+% int main() {
+% 	Fib f1, f2;
+% 	for ( 10 )
+% 		sout | next( f1 ) | next( f2 );
+% }
+% \end{cfa}
+% \end{lrbox}
+% \newbox\myboxB
+% \begin{lrbox}{\myboxB}
+% \begin{python}[aboveskip=0pt,belowskip=0pt]
+% 
+% def Fibonacci():
+% 	fn = 0;	fn1 = fn; `yield fn`  # suspend
+% 	fn = 1; fn2 = fn1; fn1 = fn; `yield fn`
+% 	while True:
+% 		fn = fn1 + fn2; fn2 = fn1; fn1 = fn; `yield fn`
+% 
+% 
+% f1 = Fibonacci()
+% f2 = Fibonacci()
+% for i in range( 10 ):
+% 	print( `next( f1 )`, `next( f2 )` ) # resume
+% 
+% \end{python}
+% \end{lrbox}
+% \subfloat[\CFA]{\label{f:Coroutine3States}\usebox\myboxA}
+% \qquad
+% \subfloat[Python]{\label{f:Coroutine1State}\usebox\myboxB}
+% \caption{Fibonacci input coroutine, 3 states, internal variables}
+% \label{f:cfa-fibonacci}
 \end{figure}
 
Index: doc/papers/concurrency/examples/Fib2.cfa
===================================================================
--- doc/papers/concurrency/examples/Fib2.cfa	(revision 2fabdc0253be63e4524fc9b7dd87d64721f61dd9)
+++ doc/papers/concurrency/examples/Fib2.cfa	(revision 2fabdc0253be63e4524fc9b7dd87d64721f61dd9)
@@ -0,0 +1,45 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// fibonacci_1.cfa -- 1-state finite-state machine: precomputed first two states returning f(n - 1)
+//
+// Author           : Peter A. Buhr
+// Created On       : Thu Apr 26 23:20:08 2018
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Mar 22 17:26:41 2019
+// Update Count     : 28
+// 
+
+#include <fstream.hfa>
+#include <coroutine.hfa>
+
+coroutine Fibonacci { int fn1; };						// used for communication
+
+void main( Fibonacci & fib ) with( fib ) {				// called on first resume
+	int fn;
+	[fn1, fn] = [0, 1];									// precompute first two states
+	for () {
+		suspend();										// restart last resume
+		[fn1, fn] = [fn, fn1 + fn];						// general case
+	} // for
+}
+
+int ?()( Fibonacci & fib ) with( fib ) {				// function call operator
+	resume( fib );										// restart last suspend
+	return fn1;
+}
+
+int main() {
+	Fibonacci f1, f2;
+	for ( 10 ) {										// print N Fibonacci values
+		sout | f1() | f2();
+	} // for
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa fibonacci_1.cfa" //
+// End: //
Index: doc/papers/concurrency/examples/Pingpong.cfa
===================================================================
--- doc/papers/concurrency/examples/Pingpong.cfa	(revision ae6b6cf796a0f3fdf820aab4c5ad66768ec6d9cb)
+++ doc/papers/concurrency/examples/Pingpong.cfa	(revision 2fabdc0253be63e4524fc9b7dd87d64721f61dd9)
@@ -4,16 +4,13 @@
 coroutine PingPong {
 	const char * name;
-	/* const */ unsigned int N;
-	PingPong * part;
+	unsigned int N;
+	PingPong & part;
 };
 
 void ?{}( PingPong & this, const char * name, unsigned int N, PingPong & part ) {
-	(this.__cor){name};
-	this.name = name;
-	this.N = N;
-	this.part = &part;
+	this.[name, N] = [name, N];  &this.part = &part;
 }
 void ?{}( PingPong & this, const char * name, unsigned int N ) {
-	this{ name, N, *(PingPong *)0 };
+	this{ name, N, *0p };								// call first constructor
 }
 void cycle( PingPong & pingpong ) {
@@ -21,15 +18,15 @@
 }
 void partner( PingPong & this, PingPong & part ) {
-	this.part = &part;
+	&this.part = &part;
 	resume( this );
 }
-void main( PingPong & pingpong ) {						// ping's starter ::main, pong's starter ping
-	for ( pingpong.N ) {								// N ping-pongs
-		sout | pingpong.name;
-		cycle( *pingpong.part );
+void main( PingPong & pingpong ) with(pingpong) {		// ping's starter ::main, pong's starter ping
+	for ( N ) {											// N ping-pongs
+		sout | name;
+		cycle( part );
 	} // for
 }
 int main() {
-	enum { N = 20 };
+	enum { N = 5 };
 	PingPong ping = { "ping", N }, pong = { "pong", N, ping };
 	partner( ping, pong );
@@ -38,4 +35,4 @@
 // Local Variables: //
 // tab-width: 4 //
-// compile-command: "cfa pingpong.cfa" //
+// compile-command: "cfa Pingpong.cfa" //
 // End: //
Index: doc/papers/concurrency/examples/Pingpong.py
===================================================================
--- doc/papers/concurrency/examples/Pingpong.py	(revision ae6b6cf796a0f3fdf820aab4c5ad66768ec6d9cb)
+++ doc/papers/concurrency/examples/Pingpong.py	(revision 2fabdc0253be63e4524fc9b7dd87d64721f61dd9)
@@ -1,33 +1,32 @@
-def Scheduler
+def PingPong( name, N ):
+	partner = (yield)           # get partner
+	yield                       # resume scheduler
+	for i in range( N ):
+		print( name )
+		yield partner           # execute next
+	print( "end", name )
+
+def Scheduler():
+	n = (yield)                 # starting coroutine
+	while True:
+		n = next( n )           # schedule coroutine
+
+pi = PingPong( "ping", 5 )
+po = PingPong( "pong", 5 )
+next( pi )                      # prime
+pi.send( po )                   # send partner
+next( po )                      # prime
+po.send( pi )                   # send partner
+
+s = Scheduler();
+next( s )                       # prime
 try:
-	yield from ping();
-	yield from pong();
+	s.send( pi )				# start cycle
 except StopIteration:
-	print( "Scheduler stop" )
-
-
-def pong():
-	print( "pong" )
-for i in range( 10 ):
-
-		yield from ping()
-	print( "stop pong" )
-
-def ping():
-	global i
-	print( "ping" )
-	i += 1
-	if i < 5:
-		yield from pong()
-	print( "stop ping" )
-
-p = ping()
-try:
-	next( p )
-except StopIteration:
-	print( "stop" )
+	print( "scheduler stop" )
+print( "stop" )
 
 # Local Variables: #
 # tab-width: 4 #
-# compile-command: "python3.5 pingpong.py" #
+# compile-command: "python3.5 Pingpong.py" #
 # End: #
Index: doc/papers/concurrency/examples/ProdCons.cfa
===================================================================
--- doc/papers/concurrency/examples/ProdCons.cfa	(revision ae6b6cf796a0f3fdf820aab4c5ad66768ec6d9cb)
+++ doc/papers/concurrency/examples/ProdCons.cfa	(revision 2fabdc0253be63e4524fc9b7dd87d64721f61dd9)
@@ -23,8 +23,8 @@
 	sout | "prod stops";
 }
-int payment( Prod & prod, int money ) {
-	prod.money = money;
+int payment( Prod & prod, int m ) with(prod) {
+	money = m;
 	resume( prod );										// main 1st time, then
-	return prod.receipt;								// prod in delivery
+	return receipt;										// prod in delivery
 }
 void start( Prod & prod, int N, Cons &c ) {
Index: doc/papers/concurrency/examples/ProdCons.py
===================================================================
--- doc/papers/concurrency/examples/ProdCons.py	(revision 2fabdc0253be63e4524fc9b7dd87d64721f61dd9)
+++ doc/papers/concurrency/examples/ProdCons.py	(revision 2fabdc0253be63e4524fc9b7dd87d64721f61dd9)
@@ -0,0 +1,40 @@
+def Prod( N ):
+	cons = (yield)              # get cons
+	yield                       # resume scheduler
+	for i in range( N ):
+		print( "prod" )
+		yield cons              # execute next
+	print( "end", "prod" )
+
+def Cons( N ):
+	prod = (yield)              # get prod
+	yield                       # resume scheduler
+	for i in range( N ):
+		print( "cons" )
+		yield prod              # execute next
+	print( "end", "cons" )
+
+def Scheduler():
+	n = (yield)                 # starting coroutine
+	while True:
+		n = next( n )           # schedule coroutine
+
+prod = Prod( 5 )
+cons = Cons( 5 )
+next( prod )                    # prime
+prod.send( cons )               # send cons
+next( cons )                    # prime
+cons.send( prod )               # send prod
+
+s = Scheduler();
+next( s )                       # prime
+try:
+	s.send( prod )				# start cycle
+except StopIteration:
+	print( "scheduler stop" )
+print( "stop" )
+
+# Local Variables: #
+# tab-width: 4 #
+# compile-command: "python3.5 ProdCons.py" #
+# End: #
