Index: src/examples/Makefile.am
===================================================================
--- src/examples/Makefile.am	(revision 097e2b0772ff883a03cce4090b9e0ba0be47ac18)
+++ src/examples/Makefile.am	(revision 05587c2d3a71d2b397650a80fab2b53de1a89dc7)
@@ -11,6 +11,6 @@
 ## Created On       : Sun May 31 09:08:15 2015
 ## Last Modified By : Peter A. Buhr
-## Last Modified On : Thu Jun  4 23:13:10 2015
-## Update Count     : 22
+## Last Modified On : Thu Nov 19 18:01:56 2015
+## Update Count     : 23
 ###############################################################################
 
@@ -20,4 +20,4 @@
 
 noinst_PROGRAMS = fstream_test vector_test
-fstream_test_SOURCES = iostream.c fstream.c fstream_test.c
+fstream_test_SOURCES = iostream.c fstream.c fstream_test.c iterator.c
 vector_test_SOURCES = vector_int.c fstream.c iostream.c array.c iterator.c vector_test.c
Index: src/examples/Makefile.in
===================================================================
--- src/examples/Makefile.in	(revision 097e2b0772ff883a03cce4090b9e0ba0be47ac18)
+++ src/examples/Makefile.in	(revision 05587c2d3a71d2b397650a80fab2b53de1a89dc7)
@@ -49,5 +49,5 @@
 PROGRAMS = $(noinst_PROGRAMS)
 am_fstream_test_OBJECTS = iostream.$(OBJEXT) fstream.$(OBJEXT) \
-	fstream_test.$(OBJEXT)
+	fstream_test.$(OBJEXT) iterator.$(OBJEXT)
 fstream_test_OBJECTS = $(am_fstream_test_OBJECTS)
 fstream_test_LDADD = $(LDADD)
@@ -176,5 +176,5 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-fstream_test_SOURCES = iostream.c fstream.c fstream_test.c
+fstream_test_SOURCES = iostream.c fstream.c fstream_test.c iterator.c
 vector_test_SOURCES = vector_int.c fstream.c iostream.c array.c iterator.c vector_test.c
 all: all-am
Index: src/examples/iostream.c
===================================================================
--- src/examples/iostream.c	(revision 097e2b0772ff883a03cce4090b9e0ba0be47ac18)
+++ src/examples/iostream.c	(revision 05587c2d3a71d2b397650a80fab2b53de1a89dc7)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed May 27 18:18:13 2015
-// Update Count     : 2
+// Last Modified On : Thu Nov 19 17:54:38 2015
+// Update Count     : 4
 //
 
@@ -30,5 +30,5 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?<<?( ostype *os, int i ) {
-	char buffer[20];      // larger than the largest integer
+	char buffer[32];									// larger than the largest integer
 	sprintf( buffer, "%d", i );
 	return write( os, buffer, strlen( buffer ) );
@@ -37,5 +37,5 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?<<?( ostype *os, double d ) {
-	char buffer[32];      // larger than the largest double
+	char buffer[32];									// larger than the largest double
 	sprintf( buffer, "%g", d );
 	return write( os, buffer, strlen( buffer ) );
@@ -46,4 +46,32 @@
 	return write( os, cp, strlen( cp ) );
 }
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?<<?( ostype *os, const void *p ) {
+	char buffer[32];									// larger than the largest pointer
+	sprintf( buffer, "%p", p );
+	return write( os, buffer, strlen( buffer ) );
+}
+
+forall( type elt_type | writeable( elt_type ),
+		type iterator_type | iterator( iterator_type, elt_type ),
+		dtype os_type | ostream( os_type ) )
+void write( iterator_type begin, iterator_type end, os_type *os ) {
+	void print( elt_type i ) {
+		os << i << ' ';
+	}
+	for_each( begin, end, print );
+}
+
+forall( type elt_type | writeable( elt_type ),
+		type iterator_type | iterator( iterator_type, elt_type ),
+		dtype os_type | ostream( os_type ) )
+void write_reverse( iterator_type begin, iterator_type end, os_type *os ) {
+	void print( elt_type i ) {
+		os << i << ' ';
+	}
+	for_each_reverse( begin, end, print );
+}
+
 
 forall( dtype istype | istream( istype ) )
Index: src/examples/iostream.h
===================================================================
--- src/examples/iostream.h	(revision 097e2b0772ff883a03cce4090b9e0ba0be47ac18)
+++ src/examples/iostream.h	(revision 05587c2d3a71d2b397650a80fab2b53de1a89dc7)
@@ -10,10 +10,12 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed May 27 18:18:46 2015
-// Update Count     : 1
+// Last Modified On : Thu Nov 19 17:56:51 2015
+// Update Count     : 5
 //
 
 #ifndef IOSTREAM_H
 #define IOSTREAM_H
+
+#include "iterator.h"
 
 typedef unsigned long streamsize_type;
@@ -34,4 +36,16 @@
 forall( dtype ostype | ostream( ostype ) ) ostype * ?<<?( ostype *, double );
 forall( dtype ostype | ostream( ostype ) ) ostype * ?<<?( ostype *, const char * );
+forall( dtype ostype | ostream( ostype ) ) ostype * ?<<?( ostype *, void * );
+
+// writes the range [begin, end) to the given stream
+forall( type elt_type | writeable( elt_type ),
+		type iterator_type | iterator( iterator_type, elt_type ),
+		dtype os_type | ostream( os_type ) )
+void write( iterator_type begin, iterator_type end, os_type *os );
+
+forall( type elt_type | writeable( elt_type ),
+		type iterator_type | iterator( iterator_type, elt_type ),
+		dtype os_type | ostream( os_type ) )
+void write_reverse( iterator_type begin, iterator_type end, os_type *os );
 
 
Index: src/examples/iterator.c
===================================================================
--- src/examples/iterator.c	(revision 097e2b0772ff883a03cce4090b9e0ba0be47ac18)
+++ src/examples/iterator.c	(revision 05587c2d3a71d2b397650a80fab2b53de1a89dc7)
@@ -10,40 +10,23 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed May 27 18:41:41 2015
-// Update Count     : 3
+// Last Modified On : Thu Nov 19 17:54:37 2015
+// Update Count     : 24
 //
 
 #include "iterator.h"
 
-/// forall( type iterator_type, type elt_type | iterator( iterator_type, elt_type ) )
-/// void
-/// for_each( iterator_type begin, iterator_type end, void (*func)( elt_type ) )
-/// {
-///   iterator_type i;
-///   for ( i = begin; i != end; ++i ) {
-///	 func( *i );
-///   }
-/// }
-
-forall( type elt_type | writeable( elt_type ),
-		type iterator_type | iterator( iterator_type, elt_type ),
-		dtype os_type | ostream( os_type ) )
-void write_all( iterator_type begin, iterator_type end, os_type *os ) {
-	iterator_type i;
-	for ( i = begin; i != end; ++i ) {
-		os << *i << ' ';
+forall( type iterator_type, type elt_type | iterator( iterator_type, elt_type ) )
+void for_each( iterator_type begin, iterator_type end, void (*func)( elt_type ) ) {
+	for ( iterator_type i = begin; i != end; ++i ) {
+		func( *i );
 	}
 }
 
-forall( type elt_type | writeable( elt_type ),
-		type iterator_type | iterator( iterator_type, elt_type ),
-		dtype os_type | ostream( os_type ) )
-void write_reverse( iterator_type begin, iterator_type end, os_type *os ) {
-	iterator_type i; // "= end;" does not work
-	i = end;
-	do {
+forall( type iterator_type, type elt_type | iterator( iterator_type, elt_type ) )
+void for_each_reverse( iterator_type begin, iterator_type end, void (*func)( elt_type ) ) {
+	for ( iterator_type i = end; i != begin; ) {
 		--i;
-		os << *i << ' ';
-	} while ( i != begin );
+		func( *i );
+	}
 }
 
Index: src/examples/iterator.h
===================================================================
--- src/examples/iterator.h	(revision 097e2b0772ff883a03cce4090b9e0ba0be47ac18)
+++ src/examples/iterator.h	(revision 05587c2d3a71d2b397650a80fab2b53de1a89dc7)
@@ -10,12 +10,10 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed May 27 18:41:57 2015
-// Update Count     : 3
+// Last Modified On : Thu Nov 19 17:58:28 2015
+// Update Count     : 6
 //
 
 #ifndef ITERATOR_H
 #define ITERATOR_H
-
-#include "iostream.h"
 
 // An iterator can be used to traverse a data structure.
@@ -34,5 +32,5 @@
 };
 
-context iterator_for ( type iterator_type, type collection_type, type elt_type | iterator( iterator_type, elt_type ) ) {
+context iterator_for( type iterator_type, type collection_type, type elt_type | iterator( iterator_type, elt_type ) ) {
 //	[ iterator_type begin, iterator_type end ] get_iterators( collection_type );
 	iterator_type begin( collection_type );
@@ -43,14 +41,6 @@
 void for_each( iterator_type begin, iterator_type end, void (*func)( elt_type ) );
 
-// writes the range [begin, end) to the given stream
-forall( type elt_type | writeable( elt_type ),
-		type iterator_type | iterator( iterator_type, elt_type ),
-		dtype os_type | ostream( os_type ) )
-void write_all( iterator_type begin, iterator_type end, os_type *os );
-
-forall( type elt_type | writeable( elt_type ),
-		type iterator_type | iterator( iterator_type, elt_type ),
-		dtype os_type | ostream( os_type ) )
-void write_reverse( iterator_type begin, iterator_type end, os_type *os );
+forall( type iterator_type, type elt_type | iterator( iterator_type, elt_type ) )
+void for_each_reverse( iterator_type begin, iterator_type end, void (*func)( elt_type ) );
 
 #endif // ITERATOR_H
Index: src/examples/vector_test.c
===================================================================
--- src/examples/vector_test.c	(revision 097e2b0772ff883a03cce4090b9e0ba0be47ac18)
+++ src/examples/vector_test.c	(revision 05587c2d3a71d2b397650a80fab2b53de1a89dc7)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed May 27 18:42:55 2015
-// Update Count     : 2
+// Last Modified On : Thu Nov 19 17:54:34 2015
+// Update Count     : 9
 //
 
@@ -29,25 +29,18 @@
 	sout << "enter N elements and C-d on a separate line:\n";
 	for ( ;; ) {
-	sin >> &num;
+		sin >> &num;
 	  if ( fail( sin ) || eof( sin ) ) break;
-	append( &vec, num );
+		append( &vec, num );
 	}
 	// write out the numbers
 
 	sout << "Array elements:\n";
-//	write_all( begin( vec ), end( vec ), sout );
-//	sout << "\n";
-	for ( int index = 0; index <= last( vec ); index += 1 ) {
-	sout << vec[ index ] << " ";
-	}
+	write( begin( vec ), end( vec ), sout );
 	sout << "\n";
-#if 1
+
 	sout << "Array elements reversed:\n";
 	write_reverse( begin( vec ), end( vec ), sout );
 	sout << "\n";
-#endif
 }
-
-// ../bin/cfa vector_test.c fstream.o iostream.o vector_int.o iterator.o array.o
 
 // Local Variables: //
