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:  cabal install readline: Missing HSReadlline.h        on Mac OS
      X Leopard (Khudyakov Alexey)
   2.  ANNOUNCE: Haskell Communities and Activities Report (16th
      ed., May 2009) (Janis Voigtlaender)
   3.  Re: [Haskell] ANNOUNCE: Haskell Communities and  Activities
      Report (16th ed., May 2009) (Lee Duhem)
   4.  RE: [Haskell] ANNOUNCE: Haskell Communities and Activities
      Report (16th ed., May 2009) (Simon Peyton-Jones)
   5.  System.Random (Thomas Friedrich)
   6. Re:  System.Random (Alexander Dunlap)
   7. RE:  System.Random (Regis Saint-Paul)
   8. Re:  System.Random (Thomas Friedrich)


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

Message: 1
Date: Mon, 25 May 2009 15:41:16 +0400
From: Khudyakov Alexey <[email protected]>
Subject: Re: [Haskell-beginners] cabal install readline: Missing
        HSReadlline.h   on Mac OS X Leopard
To: [email protected]
Message-ID: <[email protected]>
Content-Type: Text/Plain;  charset="utf-8"

On Sunday 24 of May 2009 19:49:08 man wrote:
> I got this error installing readline (I really was installing lambdabot, it
> depends on readline):
>
> config.status: creating config.mk
> config.status: creating readline.buildinfo
> config.status: creating include/HsReadlineConfig.h
> __cabal: Missing dependency on a foreign library:__
> * Missing header file: HsReadline.h
> This problem can usually be solved by installing the system package that
> provides this library (you may need the "-dev" version). If the library is
> already installed but in a non-standard location then you can use the flags
> --extra-include-dirs= and --extra-lib-dirs= to specify where it is.
> cabal: Error: some packages failed to install:
>
I suppose that cabal could not find headers for readline. Check that they are 
installed and cabal is able to find them. 



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

Message: 2
Date: Tue, 26 May 2009 10:12:58 +0200
From: Janis Voigtlaender <[email protected]>
Subject: [Haskell-beginners] ANNOUNCE: Haskell Communities and
        Activities Report (16th ed., May 2009)
To: [email protected], [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii; format=flowed

On behalf of the many, many contributors, I am pleased to announce
that the

             Haskell Communities and Activities Report
                   (16th edition, May 2009)

              http://www.haskell.org/communities/

is now available from the Haskell Communities home page in PDF and
HTML formats.

Many thanks go to all the people that contributed to this report,
both directly, by sending in descriptions, and indirectly, by doing
all the interesting things that are reported. I hope you will find
it as interesting a read as I did.

If you have not encountered the Haskell Communities and Activities
Reports before, you may like to know that the first of these reports
was published in November 2001. Their goal is to improve the
communication between the increasingly diverse groups, projects, and
individuals working on, with, or inspired by Haskell. The idea behind
these reports is simple:

  Every six months, a call goes out to all of you enjoying Haskell to
  contribute brief summaries of your own area of work. Many of you
  respond (eagerly, unprompted, and sometimes in time for the actual
  deadline ;-) to the call. The editor collects all the contributions
  into a single report and feeds that back to the community.

When I try for the next update, six months from now, you might want
to report on your own work, project, research area or group as well.
So, please put the following into your diaries now:

           ----------------------------------------
                     End of October 2009:
           target deadline for contributions to the
           November 2009 edition of the HC&A Report
           ----------------------------------------

Unfortunately, many Haskellers working on interesting projects are so
busy with their work that they seem to have lost the time to follow
the Haskell related mailing lists and newsgroups, and have trouble even
finding time to report on their work. If you are a member, user or
friend of a project so burdened, please find someone willing to make
time to report and ask them to "register" with the editor for a simple
e-mail reminder in October (you could point me to them as well, and I
can then politely ask if they want to contribute, but it might work
better if you do the initial asking). Of course, they will still have to
find the ten to fifteen minutes to draw up their report, but maybe we
can increase our coverage of all that is going on in the community.

Feel free to circulate this announcement further in order to
reach people who might otherwise not see it. Enjoy!

Janis Voigtlaender
<hcar at haskell.org>

-- 
Dr. Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:[email protected]



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

Message: 3
Date: Tue, 26 May 2009 17:36:19 +0800
From: Lee Duhem <[email protected]>
Subject: [Haskell-beginners] Re: [Haskell] ANNOUNCE: Haskell
        Communities and Activities Report (16th ed., May 2009)
To: Janis Voigtlaender <[email protected]>
Cc: [email protected], [email protected], [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

On Tue, May 26, 2009 at 4:12 PM, Janis Voigtlaender
<[email protected]> wrote:
> On behalf of the many, many contributors, I am pleased to announce
> that the
>
>            Haskell Communities and Activities Report
>                  (16th edition, May 2009)
>
>             http://www.haskell.org/communities/
>
> is now available from the Haskell Communities home page in PDF and
> HTML formats.
>

Congratulation and thank you for your work.

BTW, I notice Haskell-Cafe isn't in the To list, I hope this isn't in
purpose :-)

lee


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

Message: 4
Date: Tue, 26 May 2009 10:22:21 +0100
From: Simon Peyton-Jones <[email protected]>
Subject: [Haskell-beginners] RE: [Haskell] ANNOUNCE: Haskell
        Communities and Activities Report (16th ed., May 2009)
To: Janis Voigtlaender <[email protected]>,
        "[email protected]" <[email protected]>,    "[email protected]"
        <[email protected]>,        "[email protected]" 
<[email protected]>
Message-ID:
        
<638abd0a29c8884a91bc5fb5c349b1c337fc667...@ea-exmsg-c334.europe.corp.microsoft.com>
        
Content-Type: text/plain; charset="us-ascii"

| On behalf of the many, many contributors, I am pleased to announce
| that the
|              Haskell Communities and Activities Report
|                    (16th edition, May 2009)
| is now available from the Haskell Communities home page in PDF and
| HTML formats.

Congratulations Janis!  Thank you from all of us for editing the HCAR.

Simon


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

Message: 5
Date: Wed, 27 May 2009 19:55:05 -0400
From: Thomas Friedrich <[email protected]>
Subject: [Haskell-beginners] System.Random
To: beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi everyone,

Using random numbers in Haskell is not entirely trivial (at least, still 
not for me) and again I am bagging my head against the Gen-Monad.  I'd 
like to write a kind of bootstrap function

sample :: Int -> [a] -> [a]
sample n xs = ...

that samples uniformly n elements from the list xs.  I am not sure how 
to go about this.  Would you try something like

sample1 :: StdGen -> Int -> [a] -> [a]

and later use this in an IO Monad, something along the lines of:  do {g 
<- mkStdGen; return $ sample g n xs}, or would you write it like

sample2 :: Int -> [a] -> Gen [a]

and then use a function from QuickCheck like `generate` to get your samples?

You see, I don't even know how to start thinking about the problem.

If anyone got an idea, I'd be pleased if you could help me.

Cheers,
Thomas




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

Message: 6
Date: Wed, 27 May 2009 20:08:52 -0700
From: Alexander Dunlap <[email protected]>
Subject: Re: [Haskell-beginners] System.Random
To: Thomas Friedrich <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

On Wed, May 27, 2009 at 4:55 PM, Thomas Friedrich <[email protected]> wrote:
> Hi everyone,
>
> Using random numbers in Haskell is not entirely trivial (at least, still not
> for me) and again I am bagging my head against the Gen-Monad.  I'd like to
> write a kind of bootstrap function
>
> sample :: Int -> [a] -> [a]
> sample n xs = ...
>
> that samples uniformly n elements from the list xs.  I am not sure how to go
> about this.  Would you try something like
>
> sample1 :: StdGen -> Int -> [a] -> [a]
>
> and later use this in an IO Monad, something along the lines of:  do {g <-
> mkStdGen; return $ sample g n xs}, or would you write it like
>
> sample2 :: Int -> [a] -> Gen [a]
>
> and then use a function from QuickCheck like `generate` to get your samples?
>
> You see, I don't even know how to start thinking about the problem.
>
> If anyone got an idea, I'd be pleased if you could help me.
>
> Cheers,
> Thomas
>
>

In general, I don't think you'd use QuickCheck to generate random
numbers. QuickCheck is, for the most part, solely for testing.

I would write

sample1 :: [a] -> StdGen -> a
sample :: [a] -> StdGen -> [a] -- defined in terms of sample1

and use the take function to trim the list to the number of items you
want. (Lazy evaluation guarantees that the rest won't get evaluated.)
Use mkStdGen to create a StdGen to pass to it.

Alex


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

Message: 7
Date: Thu, 28 May 2009 10:06:25 +0200
From: "Regis Saint-Paul" <[email protected]>
Subject: RE: [Haskell-beginners] System.Random
To: "'Thomas Friedrich'" <[email protected]>, "'beginners'"
        <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain;       charset="us-ascii"

Hi, 

Maybe you'd like to check this page: 
http://apfelmus.nfshost.com/random-permutations.html
which gives also interesting pointers to other references. 

Your sampling from a list can be seen as taking the first n elements of a
permutation of the list. Of course, computing the full permutation of a long
list to just take the first two or three elements would not be very wise. So
there are other solutions depending on your setting (sampling from a finite
list with or without replacement, sampling from an infinite list (a stream)
as data comes in, etc...
I just give some rough idea: 
- for fixed size lists, a random number can be used to skip some elements of
the list, if you start from the beginning of the list after reaching its
end, then you sample with replacement. 
- for infinite list, a list of the n sampled element is maintained. This
list is first filled with the first n elements of the source list and then,
for each new incoming element, you decide randomly if you want to keep it or
not. If you decide to keep it, you decide, also randomly, which element of
the sample list it replaces. You can find all the details in [1]. 

Do you need that for performing tests with QuickCheck or was using
QuickCheck just an idea on how to go about the problem?

Best,
Regis

[1] Vitter, Jeffrey S. 1985. "Random sampling with a reservoir." ACM Trans.
Math. Softw. 11(1):37-57.





> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of Thomas Friedrich
> Sent: Thursday, 28 May 2009 1:55 AM
> To: beginners
> Subject: [Haskell-beginners] System.Random
> 
> Hi everyone,
> 
> Using random numbers in Haskell is not entirely trivial (at least, still
> not for me) and again I am bagging my head against the Gen-Monad.  I'd
> like to write a kind of bootstrap function
> 
> sample :: Int -> [a] -> [a]
> sample n xs = ...
> 
> that samples uniformly n elements from the list xs.  I am not sure how
> to go about this.  Would you try something like
> 
> sample1 :: StdGen -> Int -> [a] -> [a]
> 
> and later use this in an IO Monad, something along the lines of:  do {g
> <- mkStdGen; return $ sample g n xs}, or would you write it like
> 
> sample2 :: Int -> [a] -> Gen [a]
> 
> and then use a function from QuickCheck like `generate` to get your
> samples?
> 
> You see, I don't even know how to start thinking about the problem.
> 
> If anyone got an idea, I'd be pleased if you could help me.
> 
> Cheers,
> Thomas
> 
> 
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners



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

Message: 8
Date: Thu, 28 May 2009 10:22:21 -0400
From: Thomas Friedrich <[email protected]>
Subject: Re: [Haskell-beginners] System.Random
To: Regis Saint-Paul <[email protected]>
Cc: 'beginners' <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi,

thanks for the web-link.  The idea of putting the whole thing into a 
random shuffling framework is in deed a really neat idea.  And it 
perfectly suits my purpose.  I don't need it for QuickCheck, it was just 
an idea.

Cheers,
Thomas



Regis Saint-Paul wrote:
> Hi, 
>
> Maybe you'd like to check this page: 
> http://apfelmus.nfshost.com/random-permutations.html
> which gives also interesting pointers to other references. 
>
> Your sampling from a list can be seen as taking the first n elements of a
> permutation of the list. Of course, computing the full permutation of a long
> list to just take the first two or three elements would not be very wise. So
> there are other solutions depending on your setting (sampling from a finite
> list with or without replacement, sampling from an infinite list (a stream)
> as data comes in, etc...
> I just give some rough idea: 
> - for fixed size lists, a random number can be used to skip some elements of
> the list, if you start from the beginning of the list after reaching its
> end, then you sample with replacement. 
> - for infinite list, a list of the n sampled element is maintained. This
> list is first filled with the first n elements of the source list and then,
> for each new incoming element, you decide randomly if you want to keep it or
> not. If you decide to keep it, you decide, also randomly, which element of
> the sample list it replaces. You can find all the details in [1]. 
>
> Do you need that for performing tests with QuickCheck or was using
> QuickCheck just an idea on how to go about the problem?
>
> Best,
> Regis
>
> [1] Vitter, Jeffrey S. 1985. "Random sampling with a reservoir." ACM Trans.
> Math. Softw. 11(1):37-57.
>
>
>
>
>
>   
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]]
>> On Behalf Of Thomas Friedrich
>> Sent: Thursday, 28 May 2009 1:55 AM
>> To: beginners
>> Subject: [Haskell-beginners] System.Random
>>
>> Hi everyone,
>>
>> Using random numbers in Haskell is not entirely trivial (at least, still
>> not for me) and again I am bagging my head against the Gen-Monad.  I'd
>> like to write a kind of bootstrap function
>>
>> sample :: Int -> [a] -> [a]
>> sample n xs = ...
>>
>> that samples uniformly n elements from the list xs.  I am not sure how
>> to go about this.  Would you try something like
>>
>> sample1 :: StdGen -> Int -> [a] -> [a]
>>
>> and later use this in an IO Monad, something along the lines of:  do {g
>> <- mkStdGen; return $ sample g n xs}, or would you write it like
>>
>> sample2 :: Int -> [a] -> Gen [a]
>>
>> and then use a function from QuickCheck like `generate` to get your
>> samples?
>>
>> You see, I don't even know how to start thinking about the problem.
>>
>> If anyone got an idea, I'd be pleased if you could help me.
>>
>> Cheers,
>> Thomas
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>     
>
>   



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

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


End of Beginners Digest, Vol 11, Issue 18
*****************************************

Reply via email to