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 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 one element from each of the
 input lists¹:

  perms :: [[a]] - [[a]]

 You need to consider two cases, when the input is empty, and when the
 input contains at least one list of elements:

  perms (l:ls) = ...
  perms [] = ...

 The second case shouldn't be so hard.

 Now, if you pretend that 'perms' is already implemented, then you can
 use it to generate all permutations for the tail of the input list.  The
 first case boils down to combining the first input list with all
 permutations of the rest of the lists:

  perms (l:ls) = ... l ... perms ls

 Does this help?

 -k

 ¹ Using tuples is harder to generalize for length, but nicer typewise,
 since you'd get something like 'perms :: ([a],[b],..[x]) - [(a,b,..,x)]
 --
 If I haven't seen further, it is by standing in the footprints of giants
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
GNU/Linux user #446397 - http://counter.li.org
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Improved message for GHC No instance for Errors

2009-12-24 Thread Victor Mateus Oliveira
Hi,

I would like to propose a modification in the ghc message for no
instance for errors.
In the message, the ghc tells that there's no instance for the type
you are using and it give you a hint that you can fix it adding a new
instance for your type. But it don't tell me any instance alternative
that already exists. So, if I don't know the correct type, I need to
look at the documentation.

At least for me, I get this message when I'm using the function in the
wrong way or when I forget to specify the some function signature.
It's quite rare the I want to add a new instance.
Of course that it's not a problem to look at the documentation, but
improving it can save a significant time and help the beginers to
guess the error and how fix it.

In C++ and Java, when I use g++ or javac and I make a wrong
overloading, the compiler show me some alternatives. I think it help
more than tell me to add a new overload to the function.

It's possible to do it in ghc?

I'm new haskell programmer and I enjoying a lot this language.

[]s
Victor

-- 
GNU/Linux user #446397 - http://counter.li.org
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Graph drawing library for Haskell

2009-11-20 Thread Victor Mateus Oliveira
Hi,

Anyone knows a good library for graph diagram drawing? Or a haskell
binding for one?
Something like jgraph. http://www.jgraph.com/jgraph.html

[]s'
Victor

-- 
GNU/Linux user #446397 - http://counter.li.org
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Graph drawing library for Haskell

2009-11-20 Thread Victor Mateus Oliveira
I'm looking for something more integrated with a gui library. The
jgraph integrates with swing, so you can move, create, delete, have
popup menus, select nodes, and so on.

I haven't found yet.. If there isn't, I thinking in create one lib
with wxHaskell using wxDC... But by now, I really prefer to use one
existing library.

[]s
Victor

On Fri, Nov 20, 2009 at 12:00 PM, Magnus Therning mag...@therning.org wrote:
 On Fri, Nov 20, 2009 at 1:57 PM, Victor Mateus Oliveira
 rhapso...@gmail.com wrote:
 Hi,

 Anyone knows a good library for graph diagram drawing? Or a haskell
 binding for one?
 Something like jgraph. http://www.jgraph.com/jgraph.html

 I usually turn to graphviz for my Haskell graphing needs.

 /M

 --
 Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
 magnus@therning.org          Jabber: magnus@therning.org
 http://therning.org/magnus         identi.ca|twitter: magthe




-- 
GNU/Linux user #446397 - http://counter.li.org
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe