[comp.lang.icon] Another testimonial

clayton@thumper.bellcore.com (R. Clayton) (08/26/89)

My icon programs often are written as a series of filters on a objects
in a stream.  The filters do one object look-ahead on the stream with a
read/pushback sequence, with read implemented something like this: 

   global push_back_o

   procedure next_o()

      local o

      if \push_back_o then {
	 o := push_back_o
	 push_back_o := &null
	 return o
	 }
      else return read_o()

      end # next_o

It eventually occurred to me that I could use the local variable's &null
initialization to rewrite the then part of the if statement as 

   return o :=: push_back_o

which lets the procedure body collapse to

   return ((\push_back_o & (o :=: push_back_o)) | read_o())

and again to

   return (o :=: \push_back_o) | read_o()