Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Hackage down? (Lorenzo Bolla)
   2. Re:  Graph Coloring Library? (KC)
   3. Re:  Hackage down? (Brent Yorgey)
   4. Re:  Comments on Map/Reduce Code (Brent Yorgey)


----------------------------------------------------------------------

Message: 1
Date: Sat, 14 Jul 2012 22:56:30 +0100
From: Lorenzo Bolla <[email protected]>
Subject: Re: [Haskell-beginners] Hackage down?
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Thu, Jul 12, 2012 at 11:29:42AM -0400, Brent Yorgey wrote:
> Looks like Hackage is back up now.  The official word is that
> something (not sure what yet) was hitting the server really hard and
> causing the load average to go through the roof, and it had to be
> rebooted.
> 
> For future reference, an up-to-date mirror of the packages is
> maintained at 
> 
>   http://hdiff.luite.com/packages/archive/
> 
> -Brent

Thanks, good to know.
Is there a way to configure cabal to use the mirror, instead?



-- 
Lorenzo Bolla
http://lbolla.info



------------------------------

Message: 2
Date: Sat, 14 Jul 2012 14:56:08 -0700
From: KC <[email protected]>
Subject: Re: [Haskell-beginners] Graph Coloring Library?
To: Alec Story <[email protected]>
Cc: [email protected], haskell-cafe <[email protected]>
Message-ID:
        <CAMLKXy=r6mywfleptej7tr6qvtq0qtac7m61egzovyddnmv...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

This may help:
- use hMatrix to find the eigenvalues of the adjacency matrix

Then by the following theorems:

"An upper bound on the chromatic number in terms of eigenvalues was
discovered by Wilf(1967).

Chromatic Number(G) <= 1 + lambda_1(G)

Hoffman (1977) discovered a lower bound on the chromatic number in terms of
the smallest and largest eigenvalue.

Chromatic Number(G)  >= 1 - (lambda_1/lambda_n) for n>=2."

>From "The Mutually Beneficial Relationship of Graphs and Matrices", Richard
A. Brualdi,CBMS Series,Number 115, 2011.



On Fri, Jul 13, 2012 at 1:43 PM, Alec Story <[email protected]> wrote:

> I have a problem where I need to find the smallest k-coloring for a graph
> that represents conflicts between objects.  Is there a Haskell library that
> will do this for me?  I'm not particularly concerned about speed, and it's
> unlikely that I'll generate really bad edge cases, but I'd prefer to do
> something other than write the really bad try-every-case algorithm.
>
> --
> Alec Story
> Cornell University
> Biological Sciences, Computer Science 2012
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>


-- 
--
Regards,
KC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20120714/337d68b6/attachment.htm>

------------------------------

Message: 3
Date: Sat, 14 Jul 2012 20:23:54 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] Hackage down?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Sat, Jul 14, 2012 at 10:56:30PM +0100, Lorenzo Bolla wrote:
> On Thu, Jul 12, 2012 at 11:29:42AM -0400, Brent Yorgey wrote:
> > Looks like Hackage is back up now.  The official word is that
> > something (not sure what yet) was hitting the server really hard and
> > causing the load average to go through the roof, and it had to be
> > rebooted.
> > 
> > For future reference, an up-to-date mirror of the packages is
> > maintained at 
> > 
> >   http://hdiff.luite.com/packages/archive/
> > 
> > -Brent
> 
> Thanks, good to know.
> Is there a way to configure cabal to use the mirror, instead?

I believe you can do this by setting the 'remote-repo' property in
your ~/.cabal/config file.  There doesn't seem to be a command-line
option to set it.

-Brent



------------------------------

Message: 4
Date: Sat, 14 Jul 2012 20:35:44 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] Comments on Map/Reduce Code
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

On Fri, Jul 13, 2012 at 06:02:02PM +0200, Thomas Bach wrote:
> Hi Brent,
> 
> thanks for your suggestions. I got further suggestions as a private
> e-mail and finally came up with the following solution ? suggestions
> welcome:

Looks good!

> The reducer still throws an error when piping in an empty
> newline. But, I'm not sure, what a proper solution for this could be.

The problem is your 'summation' function:

  summation :: Num b => [(a, b)] -> (a, b)

In fact, it is impossible to implement something with this type which
works for all inputs.  If you get the empty list as input, there is no
way to make up a value of type 'a' in the output tuple.

Now, if you happen to know a more concrete type for 'a' then you can
do it by using some sort of default value.  For example, in your case
it looks like 'a' will actually be TL.Text.  So you could write

  summation :: Num b => [(TL.Text, b)] -> (TL.Text, b)

by doing something like returning the empty string along with 0 in the
case that the input list is empty.

In this particular case it is probably not that big of a deal.  It is
just good practice to try to always write *total* functions, that is,
functions which give a sensible result (i.e. do not crash) for every
possible input.  This means doing things like (1) make sure you have
covered every possible case when pattern-matching; (2) do not use
functions which can crash like 'head' or 'tail' (use pattern-matching
instead).

> On Tue, Jul 10, 2012 at 10:19:48AM -0400, Brent Yorgey wrote:
> > On Thu, Jul 05, 2012 at 03:50:32PM +0200, Thomas Bach wrote:
> > 
> > Instead of using a chain of ($), it's generally considered better
> > style to use a chain of (.) with a single $ at the end, like
> 
> I often find myself trying different combinations of ($), (.) or
> putting things in brackets, when the compiler throws an error on
> me. Without really knowing why things sometimes work out and sometimes
> don't. I find this part especially confusing!

This can be confusing at first.  The solution is (1) make sure you
understand how parsing/operator precedence work, and (2) think hard
about the types of operators like ($) and (.), and what any type
errors are telling you.  You really will not learn much by just
randomly trying to insert ($), (.) or parentheses.

-Brent



------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 49, Issue 15
*****************************************

Reply via email to