Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-15 Thread Magicloud Magiclouds
Sorry, I did not make it clear, since I did not know how to say this in technical terms. With comprehension, I could get all the possibilities that draw one elem from each list and put them together. But consider this: for example, there are two types of pet, dog and cat. And there are two

Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-15 Thread Magicloud Magiclouds
I realized I fell into the trap of wrong way. Thank you. On Fri, Mar 12, 2010 at 4:16 PM, Ketil Malde ke...@malde.org wrote: Casey Hawthorne cas...@istar.ca writes:  For example, I have this: list1 = [a, b, c] list2 = [d, e, f] list3 = [g, h, i] Think in abstract terms what you want to

Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-15 Thread Daniel Fischer
Am Montag 15 März 2010 08:37:20 schrieb Magicloud Magiclouds: Sorry, I did not make it clear, since I did not know how to say this in technical terms. With comprehension, I could get all the possibilities that draw one elem from each list and put them together. But consider this: for example,

Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-15 Thread Magicloud Magiclouds
Oh, that is not a precondition. So the answer of yours are correct. I am working on permutations. I used it in a wrong way. On Mon, Mar 15, 2010 at 4:39 PM, Daniel Fischer daniel.is.fisc...@web.de wrote: Am Montag 15 März 2010 08:37:20 schrieb Magicloud Magiclouds: Sorry, I did not make it

Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-15 Thread Richard O'Keefe
On Mar 15, 2010, at 8:37 PM, Magicloud Magiclouds wrote: Sorry, I did not make it clear, since I did not know how to say this in technical terms. Technical terms are not necessary, but absent those, clear examples are. With comprehension, I could get all the possibilities that draw one

Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-14 Thread Richard O'Keefe
The first question is what does 'all the combinations' actually MEAN? We are told that f [a,b,c] [d,e,f] [g,h,i] = [[(a,d,g),(b,e,h),(c,f,i)], ...] in which the first element of the result is just zip3 [a,b,c] [d,e,f], [g,h,i]. But what are the other elements? Why is all

Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-12 Thread Ketil Malde
Casey Hawthorne cas...@istar.ca writes: For example, I have this: list1 = [a, b, c] list2 = [d, e, f] list3 = [g, h, i] Think in abstract terms what you want to accomplish. A bit more specifically, let's say the input is a list of lists, and you want to produce all combinations of drawing

Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-12 Thread Victor Mateus Oliveira
Hi, Give a try to this library: http://hackage.haskell.org/package/permutation You can construct the combinations with list of indices and then apply it to your sets. []s Victor On Fri, Mar 12, 2010 at 5:16 AM, Ketil Malde ke...@malde.org wrote: Casey Hawthorne cas...@istar.ca writes:  For

Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-12 Thread Thomas Hartman
There is also polyomino.f2s: http://www.polyomino.f2s.com/david/haskell/combinatorics.html Iirc correctly there is some stuff here that is not on hackage but probably could/should be. 2010/3/12 Victor Mateus Oliveira rhapso...@gmail.com: Hi, Give a try to this library:

[Haskell-cafe] How to do the permutation and combination thing?

2010-03-11 Thread Magicloud Magiclouds
Hi, For example, I have this: list1 = [a, b, c] list2 = [d, e, f] list3 = [g, h, i] Now I want: [ [(a, d, g), (b, e, h), (c, f, i)] , ... ] -- a list that contains all the combinations. How to do it pretty? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 ___

Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-11 Thread Casey Hawthorne
This sounds like homework. Think in abstract terms what you want to accomplish. Start with the simplest case first, usually the base case. On Fri, 12 Mar 2010 14:02:02 +0800, you wrote: Hi, For example, I have this: list1 = [a, b, c] list2 = [d, e, f] list3 = [g, h, i] Now I want: [ [(a,

Re: [Haskell-cafe] How to do the permutation and combination thing?

2010-03-11 Thread Magicloud Magiclouds
All I could get is to use permutations and concatMap. But it looks really ugly. On Fri, Mar 12, 2010 at 2:09 PM, Casey Hawthorne cas...@istar.ca wrote: This sounds like homework. Think in abstract terms what you want to accomplish. Start with the simplest case first, usually the base case.