[racket] FW: q about code for partitions

From: Jos Koot (jos.koot at gmail.com)
Date: Thu Jul 17 07:56:48 EDT 2014

Version 6.0.1 shows the same problem, that is, no problem with racket, only
with DrRacket.
Jos 

> -----Original Message-----
> From: Matthew Flatt [mailto:mflatt at cs.utah.edu] 
> Sent: jueves, 17 de julio de 2014 13:48
> To: Jos Koot
> Cc: 'Jens Axel Søgaard'; 'Vincent St-Amour'; 'Eric Dobson'; 
> 'Racket Users List'
> Subject: RE: [racket] FW: q about code for partitions
> 
> I'll work on this. Thanks!
> 
> At Thu, 17 Jul 2014 13:41:28 +0200, "Jos Koot" wrote:
> > Strange: I do not get a segfault when running racket, only 
> when running from
> > DrRacket.
> > Jos 
> > 
> > > -----Original Message-----
> > > From: jensaxelsoegaard at gmail.com 
> > > [mailto:jensaxelsoegaard at gmail.com] On Behalf Of Jens Axel Søgaard
> > > Sent: jueves, 17 de julio de 2014 13:12
> > > To: Jos Koot
> > > Cc: Vincent St-Amour; Eric Dobson; Matthew Flatt; Racket 
> Users List
> > > Subject: Re: [racket] FW: q about code for partitions
> > > 
> > > What you describe seems more like a bug in partitions than a 
> > > documentation bug.
> > > Do you have a small example that provoke a segfault?
> > > 
> > > /Jens Axel
> > > 
> > > 
> > > 2014-07-17 12:41 GMT+02:00 Jos Koot <jos.koot at gmail.com>:
> > > > The documentation of partitions has not yet been updated, 
> > > as far as I can
> > > > see in version 6.0.1.13--2014-07-08(7735dd0/a) [3m]. I 
> > > don't want to hurry
> > > > up things (there may be other priorities) but when the docs 
> > > will be updated,
> > > > I think they should include a warning against calling 
> > > function partitions
> > > > from two concurrently running futures or threads. Reason is 
> > > the non atomic
> > > > memoization. (let alone calling set-partitions-cache in one 
> > > process while
> > > > another one is consulting/updating the cache)
> > > >
> > > > Calling partitions from two concurrent futures gives me a 
> > > segfault. Not a
> > > > surprise.
> > > > Up to now calling from two concurrent threads gives me 
> > > correct results, but
> > > > slows down vvveeerrryyy much.
> > > > I assume concurrent threads can lead to the same problems 
> > > as concurrent
> > > > futures, though.
> > > > If I understand places correctly, calling from concurrent 
> > > places should go
> > > > well. Do I understand correctly?
> > > >
> > > > Jos
> > > >
> > > >> -----Original Message-----
> > > >> From: Vincent St-Amour [mailto:stamourv at ccs.neu.edu]
> > > >> Sent: domingo, 29 de junio de 2014 22:52
> > > >> To: Eric Dobson
> > > >> Cc: Jos Koot; Matthew Flatt; Jens Axel Søgaard; Racket 
> Users List
> > > >> Subject: Re: [racket] FW: q about code for partitions
> > > >>
> > > >> Ah, that explains it. Thanks!
> > > >>
> > > >> Vincent
> > > >>
> > > >>
> > > >> At Sun, 29 Jun 2014 12:32:48 -0700,
> > > >> Eric Dobson wrote:
> > > >> >
> > > >> > Vincent: exact-zero? is defined through 'make-predicate' 
> > > which uses
> > > >> > contract machinery to generate the function. I filed a
> > > >> couple of bugs
> > > >> > tracking some of the slowness issues. There is no 
> `contract` form
> > > >> > though so I doubt that the coach will find it.
> > > >> >
> > > >> >
> > > >> http://bugs.racket-lang.org/query/?cmd=view%20audit-trail&data
> > > > base=default&pr=14610
> > > >> >
> > > >> http://bugs.racket-lang.org/query/?cmd=view%20audit-trail&data
> > > > base=default&pr=14611
> > > >> >
> > > >> > On Sun, Jun 29, 2014 at 11:53 AM, Jos Koot
> > > >> <jos.koot at gmail.com> wrote:
> > > >> > > Great work, Jens. I am glad my approach as been adopted
> > > >> (and much improved
> > > >> > > without deviating from the original idea of simpler
> > > >> recurrence). When can we
> > > >> > > expect it in the next nightly build?
> > > >> > >
> > > >> > > Thanks, Jos
> > > >> > >
> > > >> > >> -----Original Message-----
> > > >> > >> From: jensaxelsoegaard at gmail.com
> > > >> > >> [mailto:jensaxelsoegaard at gmail.com] On Behalf Of Jens
> > > >> Axel Søgaard
> > > >> > >> Sent: domingo, 29 de junio de 2014 12:48
> > > >> > >> To: Matthew Flatt
> > > >> > >> Cc: Jos Koot; Racket Users List
> > > >> > >> Subject: Re: [racket] FW: q about code for partitions
> > > >> > >>
> > > >> > >> I have made a new vector version using zero? instead of
> > > >> exact-zero?.
> > > >> > >>
> > > >> > >> To give users a chance to remove the cache after doing
> > > >> > >> partitions calculations,
> > > >> > >> I have added set-partitions-cache.
> > > >> > >>
> > > >> > >>    Code:
> > > >> > >>
> > > >> > >> 
> https://github.com/soegaard/racket/blob/patch-14/pkgs/math-pkg
> > > >> > > s/math-lib/math/private/number-theory/partitions.rkt
> > > >> > >>
> > > >> > >>    Discussion:
> > > >> > >>     https://github.com/plt/racket/pull/697
> > > >> > >>
> > > >> > >> /Jens Axel
> > > >> > >>
> > > >> > >>
> > > >> > >> 2014-06-29 12:44 GMT+02:00 Jens Axel Søgaard
> > > >> <jensaxel at soegaard.net>:
> > > >> > >> > 2014-06-29 8:47 GMT+02:00 Matthew Flatt 
> > > <mflatt at cs.utah.edu>:
> > > >> > >> >> It looks like "partitions2.rkt" ends up calling a
> > > >> contract-wrapped
> > > >> > >> >> variant of `exact-zero?`.
> > > >> > >> >
> > > >> > >> > That explains why Eric saw an improvement, when 
> the used #f
> > > >> > >> instead of
> > > >> > >> > 0 as the not-cached-yet value.
> > > >> > >> >
> > > >> > >> > /Jens Axel
> > > >> > >>
> > > >> > >>
> > > >> > >>
> > > >> > >> --
> > > >> > >> --
> > > >> > >> Jens Axel Søgaard
> > > >> > >
> > > >> > >
> > > >> > > ____________________
> > > >> > >   Racket Users list:
> > > >> > >   http://lists.racket-lang.org/users
> > > >> >
> > > >> > ____________________
> > > >> >   Racket Users list:
> > > >> >   http://lists.racket-lang.org/users
> > > >
> > > >
> > > > ____________________
> > > >   Racket Users list:
> > > >   http://lists.racket-lang.org/users
> > > 
> > > 
> > > 
> > > -- 
> > > --
> > > Jens Axel Søgaard



Posted on the users mailing list.