Please help me
Chris Angus
CAngus@Armature.com
Thu, 8 Feb 2001 10:29:29 -0000
Faizan,
A clue is to use list comprehensions (which are very like ZF set notation)
First think how you would define a cartesian product in set notation
X x Y x Z = {(x,y,z) | ...}
and then think how this is written in list comprehension notation
Chris
> -----Original Message-----
> From: FAIZAN RAZA [mailto:k19990158@192.168.1.4]
> Sent: 08 February 2001 13:49
> To: haskell-cafe@haskell.org
> Subject: Please help me
>
>
> Hello
>
>
> Please help me to solve this questions
>
>
> Question
>
> Cartesian Product of three sets, written as X x Y x Z is
> defined as the set
> of all ordered triples such that the first element is a
> member of X, the
> second is member of Y, and the thrid member of set Z. write a Haskell
> function cartesianProduct which when given three lists (to
> represent three
> sets) of integers returns a list of lists of ordered triples.
>
> For examples, cartesianProduct [1,3][2,4][5,6] returns
> [[1,2,5],[1,2,6],[1,4,5],[1,4,6],[3,2,5],[3,2,6],[3,4,5],[3,4,6]]
>
>
>
> Please send me reply as soon as possible
>
> Ok
>
> I wish you all the best of luck
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>