Oz and Mozart Users Mailing List

Re: Cartesian Product


From: duchier@ps.uni-sb.de
Date: Wed Dec 03 2003 - 10:21:42 CET


fmairess@student.info.ucl.ac.be (François Mairesse) writes:

> I'm trying to find an efficient and declarative way of computing the cartesian
> product of sets represented by a list of lists.

That sounds like a homework question, so I'll just give you a hint:
induction; i.e. suppose I have computed the cartesian product of N
sets, and I am given a new set: how can I compute the cartesian
product of these N+1 sets using only these 2 inputs (the cartesian
product of the previous N sets, and the new set).

Cheers,

PS: throw away your previous code :-)

-- 
Denys Duchier - Équipe Calligramme - LORIA, Nancy, France
-
Please send submissions to users@mozart-oz.org
and administriva mail to users-request@mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.
Please send bug reports to bugs@mozart-oz.org.



This archive was generated by hypermail 2b29.