[Oz] Generating lists of variables

Denys Duchier Denys.Duchier at ps.uni-sb.de
Tue Jun 27 18:12:40 CEST 2000


alainducharme at yahoo.com (Alain Ducharme) writes:

> Demand = demand(5 7 3 5)
> 
> means that four cells exist in the network, and that
> their respective capacity are 5, 7, 3 and 5. Since
> each unit of capacity must be associated to a
> variable, the end results must therefore be a record
> like:
> 
> Channel = channel( (_ _ _ _ _) (_ _ _ _ _ _ _) (_ _ _)
> (_ _ _ _ _) )
> 
> where each "_" represents one of the needed variable.
> Unfortunatly, I have been unable to achieve such as
> result, even if it's somewhat basic. Does somebody
> have a helpfull suggestion on how to procede?


{Record.map demand(5 7 3 5) fun {$ N} {Tuple.make o N} end}

This produces a recor of the form:

demand(o(_ _ _ _ _) o(_ _ _ _ _ _ _) o(_ _ _) o(_ _ _ _ _))

If you want to change the label to `channel', use Adjoin.

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