[Oz] Problem using Flatten with FS variables ....

Denys Duchier Denys.Duchier at ps.uni-sb.de
Thu Mar 2 14:37:31 CET 2000


P Ravi Prakash <ravi at konark.ncst.ernet.in> writes:

> Thanks for the solution. But List.flatten works with non-determined FD
> variables. Why are FD and FS variables treated differently?

The `case' statement in principle blocks when a clause is neither
entailed nor disentailed.  For example in

	case X
	of H|T then ...
	[] nil then ...
	else ... end

if X is non-determined it is not possible to decide what to do, and
thus the statement suspends.

However, in the interest of efficiency, when a case statement is
compiled, a dispatch table is constructed that classifies the clauses
into various groups and indexes them.  In particular, clauses that
match literals are specially indexed.  Among those, in particular
those that match integers.

A finite domain variable is known to denote an integer, and there is
special code in the `case dispatch' implementation that attempts to do
the right thing right away instead of blocking.

For Flatten, there are no `integer matching' clauses, and thus the
dispatch code jumps immediately to the else clause instead of
suspending.

Thus the blocking behavior your observe with fset variables is the
expected one.  The fact the it reduces with fd variables is just a
freebee that falls out of special indexing support.

Cheers,

-- 
Dr. Denys Duchier			Denys.Duchier at ps.uni-sb.de
Forschungsbereich Programmiersysteme	(Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45	http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50			Phone: +49 681 302 5618
66041 Saarbruecken, Germany		Fax:   +49 681 302 5615
-
Please send submissions to users at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.





More information about the mozart-users mailing list