Hi Faizan,
"FAIZAN" == FAIZAN RAZA <k19990158@192.168.1.4> writes:
FAIZAN> Hello Please help me to solve this questions FAIZAN> Question FAIZAN> Cartesian Product of three sets, written as X x Y x Z is FAIZAN> defined as the set of all ordered triples such that the FAIZAN> first element is a member of X, the second is member of Y, FAIZAN> and the thrid member of set Z. write a Haskell function FAIZAN> cartesianProduct which when given three lists (to represent FAIZAN> three sets) of integers returns a list of lists of ordered FAIZAN> triples. FAIZAN> For examples, cartesianProduct [1,3][2,4][5,6] returns FAIZAN> [[1,2,5],[1,2,6],[1,4,5],[1,4,6],[3,2,5],[3,2,6],[3,4,5],[3,4,6]] I'll leave that as an exercise for you :-) If you want to become a Haskell programmer, try it yourself. Two hints: - have a look at list comprehensions in the report - first try to solve it with two sets and pairs Cheers Christoph