[comp.lang.functional] Lazy constructors

wg@opal.cs.tu-berlin.de (Wolfgang Grieskamp) (12/17/90)

fs@rex.cs.tulane.edu (Frank Silbermann) writes:

   >[...]
   >But how can one speak of strict or lazy constructors?
   >Consider for example, the ordered pair constructor,
   >which uses elements X1 and X2 of domains D1 and D2,
   >to create the element <X1,X2> of domain D1xD2.
   >The standard selector functions will choose
   >the appropriate piece of <X1,X2> regardless
   >of whether the other side happens to be the bottom.

   >Of course, the language designer may choose to deny the programmer
   >direct access to the standard selector functions,
   >and instead provide selector functions which,
   >before selecting an element, verify that both sides
   >are strictly above bottom.  In any case,
   >the elements <X1,bot>, <bot,X2> and <bot,bot> are
   >distinct elements of D1xD2, regardless of whether
   >any particular language lets the programmer make use of this fact.

   >So, when we speak of strict constructors, are we not _really_
   >describing a property of the _selector_ functions, and not the constructor?
   >Or, is there another version of domain theory I am not aware of?

I'am not a HOPE expert (which modells lazy constructors), but as i know 
the equations will hold:

	fst(<X,bot>) = X
	snd(<bot,X>) = X

i.e. selectors dont force the product to be defined on both sides. 


What you said, however, perfectly holds for STREAMS, which are _not_ an
equivalent of lazy constructors. Streams will satisfy the equations:

	fst(<bot,...>) 	= bot
	rst(<bot,...>) 	= bot	-- rst means "rest" and yields a stream
	fst(<X,...>)   	= X
	rst(<X,...>) 	= <...>

In a language with streams, you can have bottom elements in streams, but you
cannot read over bottom. If you think of streams as communication channels,
this is quite natural, since you dont receive "suspensions" from the 
communication counterpart, but values one by one.

--
Wolfgang Grieskamp 
wg@opal.cs.tu-berlin.de tub!tubopal!wg wg%opal@DB0TUI11.BITNET