[racket] partitions

From: Jos Koot (jos.koot at gmail.com)
Date: Tue May 6 16:34:09 EDT 2014

Thanks for your advice.
Source is now on https://gist.github.com/joskoot/c80cee6fadce3434e941
Jos


  _____  

From: Laurent [mailto:laurent.orseau at gmail.com] 
Sent: martes, 06 de mayo de 2014 21:56
To: Jos Koot
Cc: Racket mailing list
Subject: Re: [racket] partitions


Why not making it a package? Or at least share it on pasterack [1] or gist
[2]?

I'm sure other people will be happy to find it in the future.


Laurent


[1] http://pasterack.org/
[2] gist.github.com



On Tue, May 6, 2014 at 8:52 PM, Jos Koot <jos.koot at gmail.com> wrote:



Hi Phil, Deren and Jensaxel,
Thanks for your quick responses.
 
To Phil:
I have read your code, but it is not lazy.
I think that for large n memory is going to be a problem.
Your eager approach resembles much my lazy code, but I produce the
partitions in reverse order.
Thanks anyway.
 
To Deeren
I'll send you the code privately.
As an example of the ordering:
(stream->list (make-partitions-stream 5)) ->
 


  _____  

From: Deren Dohoda [mailto:deren.dohoda at gmail.com] 
Sent: martes, 06 de mayo de 2014 20:36
To: Jos Koot
Cc: Racket mailing list
Subject: Re: [racket] partitions


Hi Jos,

Actually I'd love to have you share it. I did write myself a partition
generator but it was eager and I never went back to make it into a sequence
or stream, though I'm sure it was somewhere in my to-do list. How are they
ordered?

Deren



On Tue, May 6, 2014 at 2:26 PM, Jos Koot <jos.koot at gmail.com> wrote:


Hi

Library *math/number-theory* provides procedure *partitions*,
which fastly tells you how many partitions a given nonnegative integer has
(based on http://en.wikipedia.org/wiki/Partition_(number_theory))

I have not found any procedure that generates the partitions themselves,
nor in PLT Racket nor in Planet.

Therefore I made my own code for procedures that
produce (lazy) streams and sequences of partitions
(make-partition-stream n) and (in-partitions n).

If you are interested, let me know and I'll send you the code.
It is too long to include it in this mail
(77 lines of docs, 31 lines of code and 160 lines of tests)

I would be happy with some feedback on my code.
Or even happier with a pointer to already existing code.

Best whishes, Jos

____________________
  Racket Users list:
  http://lists.racket-lang.org/users




____________________
  Racket Users list:
  http://lists.racket-lang.org/users




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140506/7d6fda4c/attachment.html>

Posted on the users mailing list.