Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/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:  Relatively simple undirected graph library? (Stefan H?ck)
   2. Re:  Random variable holding a function (Heinrich Apfelmus)


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

Message: 1
Date: Fri, 27 Feb 2015 08:26:56 +0100
From: Stefan H?ck <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Relatively simple undirected graph
        library?
Message-ID: <20150227072656.GD1127@hunter>
Content-Type: text/plain; charset=iso-8859-1

Dear list

Sorry that it took so long. The usual excuses apply: Two little
children, other priorities at work, had to write two more monad
tutorials.

For better or worse, here is a first draft of a labeled graph library.

  https://github.com/stefan-hoeck/labeled-graph

This is all highly experimental. No unit tests so far and
lots of stuff is still missing, so feel free to contribute. In the next
couple of days, I'll add some more type class instances to LGraphs
(Foldable, Traversable, Bifunctor, Bifoldable, Bitraversable).

The implementation might well still change. One implementation detail
that is different compared to other graph libraries: Edges are
represented as Ints internally, so the maximal vertex is
limited by the square of the largest Int, which is rather low
on 32 bit systems. This is a typical case of bad preliminary optimisation,
since I hope that using this implementation we can use efficient
IntMaps to store edge labels. It's well possible, that this will
change in the future.

Please note also that I will use the library mainly in a cheminformatics
project, where graphs typically are small and sparse (vertices are
almost always of degree four or lower).

Gr?sse aus Z?rich

Stefan

On Wed, Feb 25, 2015 at 11:30:54PM +0100, Torsten Otto wrote:
> I second that it would be terrific to see this posted.
> 
> Regards from Hamburg,
> Torsten
> 


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

Message: 2
Date: Fri, 27 Feb 2015 10:49:56 +0100
From: Heinrich Apfelmus <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Random variable holding a function
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed

Daniel Bergey wrote:
> On 2015-02-26 at 12:42, Ondrej Nekola <[email protected]> wrote:
>>
>> I try to simulate some processes, that contain randomness and I would
>> like do it idiomatic way and keep as much code not to know about
>> randomness as possible.
>>
>> type Selection = Population -> Population
>>
>> so far, it's easy:
>>
>> allSurvive :: Selection
>> allSurvive = id
>>
>> fairChance :: Int -> Population -> RVar Population
>> fairChance newSize p = Population <$> (Data.Random.Extras.sample newSize 
>> $ individuals p)
>>
>> fairChance :: Int -> RVar Selection
>> (e.g. fairChance :: Int -> RVar (Population -> Population))
>>
>> Is there a way to do this? Or should I give up this way and try to give 
>> up some purity and go withtype Selection :: RVar Population -> RVar 
>> population?
> 
> I would define Selection as
> 
> | type Selection = Population -> RVar Population
> 
> Then you can compose with >>=, which specializes to
> 
> | (>>=) :: RVar Population -> Selection -> RVar Population
> 
> or with any of the other Monad operators (eg, >=>).
> 
> With this definition, you can keep your current definition of
> fairChance.

This is pretty much the "probability monad". For more on this, my 
personal recommendations would be

   http://apfelmus.nfshost.com/articles/random-permutations.html
   http://web.engr.oregonstate.edu/~erwig/papers/PFP_JFP06.pdf


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 80, Issue 68
*****************************************

Reply via email to