Re: [Haskell-cafe] I need a hint in list processing

2009-06-15 Thread Luke Palmer
On Sun, Jun 14, 2009 at 2:06 AM, Fernan Bolando fernanbola...@mailc.netwrote: Hi all If I have a number of list example list1 = [2,3] list2 = [1,2] list3 = [2,3,4] list4 = [1,2,3] I want to create a list from the list above with n elements, non-repeating and each elements index

Re: [Haskell-cafe] I need a hint in list processing

2009-06-15 Thread Fernan Bolando
On Sun, Jun 14, 2009 at 4:51 PM, Miguel Mitrofanovmiguelim...@yandex.ru wrote: ghci map reverse $ foldM (\answer list - [x:answer | x - list, not $ x `elem` answer]) [] [[2,3], [1,2], [2,3,4], [1,2,3]] [[2,1,4,3],[3,1,4,2],[3,2,4,1]] On 14 Jun 2009, at 12:06, Fernan Bolando wrote: Hi all

[Haskell-cafe] I need a hint in list processing

2009-06-14 Thread Fernan Bolando
Hi all If I have a number of list example list1 = [2,3] list2 = [1,2] list3 = [2,3,4] list4 = [1,2,3] I want to create a list from the list above with n elements, non-repeating and each elements index represents 1 of the elements from the corresponding list so for the above input I would get. a

Re: [Haskell-cafe] I need a hint in list processing

2009-06-14 Thread Erik de Castro Lopo
Fernan Bolando wrote: Hi all If I have a number of list example list1 = [2,3] list2 = [1,2] list3 = [2,3,4] list4 = [1,2,3] I want to create a list from the list above with n elements, non-repeating and each elements index represents 1 of the elements from the corresponding list so

Re: [Haskell-cafe] I need a hint in list processing

2009-06-14 Thread Fernan Bolando
On Sun, Jun 14, 2009 at 4:13 PM, Erik de Castro Lopomle...@mega-nerd.com wrote: Fernan Bolando wrote: Hi all If I have a number of list example list1 = [2,3] list2 = [1,2] list3 = [2,3,4] list4 = [1,2,3] I want to create a list from the list above with n elements, non-repeating and

Re: [Haskell-cafe] I need a hint in list processing

2009-06-14 Thread Miguel Mitrofanov
ghci map reverse $ foldM (\answer list - [x:answer | x - list, not $ x `elem` answer]) [] [[2,3], [1,2], [2,3,4], [1,2,3]] [[2,1,4,3],[3,1,4,2],[3,2,4,1]] On 14 Jun 2009, at 12:06, Fernan Bolando wrote: Hi all If I have a number of list example list1 = [2,3] list2 = [1,2] list3 = [2,3,4]

Re: [Haskell-cafe] I need a hint in list processing

2009-06-14 Thread Richard O'Keefe
On 14 Jun 2009, at 8:06 pm, Fernan Bolando wrote: Hi all If I have a number of list example list1 = [2,3] list2 = [1,2] list3 = [2,3,4] list4 = [1,2,3] I want to create a list from the list above with n elements, non-repeating and each elements index represents 1 of the elements from the

Re: [Haskell-cafe] I need a hint in list processing

2009-06-14 Thread Tony Morris
nub . concat ? Richard O'Keefe wrote: On 14 Jun 2009, at 8:06 pm, Fernan Bolando wrote: Hi all If I have a number of list example list1 = [2,3] list2 = [1,2] list3 = [2,3,4] list4 = [1,2,3] I want to create a list from the list above with n elements, non-repeating and each elements

Re: [Haskell-cafe] I need a hint in list processing

2009-06-14 Thread Tony Morris
Just guessing. How do you know it's an accident? Richard O'Keefe wrote: On 15 Jun 2009, at 4:26 pm, Tony Morris wrote: Prelude Data.List nub . concat $ [[2, 3], [1, 2], [2, 3, 4], [1, 2, 3]] [2,3,1,4] In this particular case. But that's a lucky accident.\ -- Tony Morris