Index: src/examples/Makefile.am
===================================================================
--- src/examples/Makefile.am	(revision 70d4b4f92fa857c1dab2358ce4b4861361e4e74c)
+++ src/examples/Makefile.am	(revision ed1065cf203b07392f55283f52fd47be3012ffcb)
@@ -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 : Fri Nov 20 16:03:46 2015
+## Update Count     : 24
 ###############################################################################
 
@@ -19,5 +19,5 @@
 CC = @CFA_BINDIR@/cfa
 
-noinst_PROGRAMS = fstream_test vector_test
-fstream_test_SOURCES = iostream.c fstream.c fstream_test.c
+noinst_PROGRAMS = fstream_test vector_test # build but do not install
+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 70d4b4f92fa857c1dab2358ce4b4861361e4e74c)
+++ src/examples/Makefile.in	(revision ed1065cf203b07392f55283f52fd47be3012ffcb)
@@ -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/fstream.c
===================================================================
--- src/examples/fstream.c	(revision 70d4b4f92fa857c1dab2358ce4b4861361e4e74c)
+++ src/examples/fstream.c	(revision ed1065cf203b07392f55283f52fd47be3012ffcb)
@@ -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:12:33 2015
-// Update Count     : 2
+// Last Modified On : Thu Nov 19 22:43:31 2015
+// Update Count     : 4
 //
 
@@ -30,11 +30,11 @@
 		fwrite( data, size, 1, os->file );
 		os->fail = ferror( os->file );
-	}
+	} // if
 	return os;
-}
+} // write
 
 int fail( ofstream *os ) {
 	return os->fail;
-}
+} // fail
 
 static ofstream *make_ofstream() {
@@ -42,5 +42,5 @@
 	new_stream->fail = 0;
 	return new_stream;
-}
+} // make_ofstream
 
 ofstream *ofstream_stdout() {
@@ -48,5 +48,5 @@
 	stdout_stream->file = stdout;
 	return stdout_stream;
-}
+} // ofstream_stdout
 
 ofstream *ofstream_stderr() {
@@ -54,5 +54,5 @@
 	stderr_stream->file = stderr;
 	return stderr_stream;
-}
+} // ofstream_stderr
 
 ofstream *ofstream_fromfile( const char *name ) {
Index: src/examples/hello.c
===================================================================
--- src/examples/hello.c	(revision 70d4b4f92fa857c1dab2358ce4b4861361e4e74c)
+++ src/examples/hello.c	(revision ed1065cf203b07392f55283f52fd47be3012ffcb)
@@ -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:14:58 2015
-// Update Count     : 1
+// Last Modified On : Fri Nov 20 16:02:50 2015
+// Update Count     : 3
 //
 
@@ -28,4 +28,4 @@
 // Local Variables: //
 // tab-width: 4 //
-// compile-command: "cfa hello.c fstream.o iostream.o" //
+// compile-command: "cfa hello.c fstream.o iostream.o iterator.o" //
 // End: //
Index: src/examples/iostream.c
===================================================================
--- src/examples/iostream.c	(revision 70d4b4f92fa857c1dab2358ce4b4861361e4e74c)
+++ src/examples/iostream.c	(revision ed1065cf203b07392f55283f52fd47be3012ffcb)
@@ -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 : Fri Nov 20 13:19:19 2015
+// Update Count     : 9
 //
 
@@ -17,8 +17,5 @@
 extern "C" {
 #include <stdio.h>
-//#include <string.h>
-//#include <ctype.h>
-	typedef long unsigned int size_t;
-	size_t strlen(const char *s);
+#include <string.h>										// strlen
 }
 
@@ -26,29 +23,57 @@
 ostype * ?<<?( ostype *os, char c ) {
 	return write( os, &c, 1 );
-}
+} // ?<<?
 
 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 ) );
-}
+} // ?<<?
 
 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 ) );
-}
+} // ?<<?
 
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?<<?( ostype *os, const char *cp ) {
 	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 ) )
 istype * ?>>?( istype *is, char *cp ) {
 	return read( is, cp, 1 );
-}
+} // ?>>?
 
 forall( dtype istype | istream( istype ) )
@@ -72,5 +97,5 @@
 	unread( is, cur );
 	return is;
-}
+} // ?>>?
 
 // Local Variables: //
Index: src/examples/iostream.h
===================================================================
--- src/examples/iostream.h	(revision 70d4b4f92fa857c1dab2358ce4b4861361e4e74c)
+++ src/examples/iostream.h	(revision ed1065cf203b07392f55283f52fd47be3012ffcb)
@@ -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 70d4b4f92fa857c1dab2358ce4b4861361e4e74c)
+++ src/examples/iterator.c	(revision ed1065cf203b07392f55283f52fd47be3012ffcb)
@@ -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 70d4b4f92fa857c1dab2358ce4b4861361e4e74c)
+++ src/examples/iterator.h	(revision ed1065cf203b07392f55283f52fd47be3012ffcb)
@@ -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 70d4b4f92fa857c1dab2358ce4b4861361e4e74c)
+++ src/examples/vector_test.c	(revision ed1065cf203b07392f55283f52fd47be3012ffcb)
@@ -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: //
