From stephane.ducasse at free.fr Fri Aug 1 09:05:55 2008 From: stephane.ducasse at free.fr (stephane ducasse) Date: Fri, 1 Aug 2008 09:05:55 +0200 Subject: [sbe-discussion] Re: Using Dictionary as Bag, small example related to Ramanujan's highly composite numbers In-Reply-To: References: <1A1BBDD8-F80B-4498-8711-87F5EBB8217B@free.fr> Message-ID: Great! Stef On Jul 31, 2008, at 8:07 AM, Klaus D. Witzel wrote: > On Wed, 30 Jul 2008 22:41:49 +0200, stephane ducasse wrote: > >> Some texts :)? > > The following example employs a Dictionary as a Bag for computing the > number of all *combinations* of *divisors* which divide an integer > without > remainer. The Dictionary's keys are the prime divisors and its > values are > the number of occurences found during the loop. When a new prime > divisor > is found, message #at:ifAbsent: initializes its value in the Bag to > zero. > Then message #at:put: increments the occurences in the Bag. > Eventually the > Bag's values are used in an #inject:into: message for computing *d* > the > number of all possible combinations. Note that this is Ramanujan's > highly > composite number *n* when the *d* is greater than for any smaller *n*. > >> Stef >> On Jul 30, 2008, at 2:36 PM, Klaus D. Witzel wrote: >> >>> Hi, >>> >>> I've made a small example on how to use a Dictionary as Bag, for >>> computing >>> all divisior combinations of an integer. The background is from >>> Ramanujan's highly composite numbers; two related links are included >>> in >>> the method comments, FWIW, another link (with refs) is >>> >>> - http://mathworld.wolfram.com/HighlyCompositeNumber.html >>> >>> The example source code is downloadable from >>> >>> - http://bugs.squeak.org/view.php?id=7137 >>> >>> Perhaps it fits between [Collection Iterators] and [Some Hints for >>> using >>> Collections]. The method features #at:put: #at:ifAbsent: and >>> #inject:into: >>> on a Dictionary used as Bag (and of course #gcd: ). >>> >>> Something else you need from me? >>> >>> Cheers, >>> Klaus >>> _______________________________________________ >>> Sbe-discussion mailing list >>> Sbe-discussion at iam.unibe.ch >>> https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion >>> >> >> _______________________________________________ >> Sbe-discussion mailing list >> Sbe-discussion at iam.unibe.ch >> https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion > > > _______________________________________________ > Sbe-discussion mailing list > Sbe-discussion at iam.unibe.ch > https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion > From ian at cottee.org Wed Aug 27 09:05:26 2008 From: ian at cottee.org (Ian J Cottee) Date: Wed, 27 Aug 2008 08:05:26 +0100 Subject: [sbe-discussion] Error on page 226 of current book (2008/05/15) ? Message-ID: <6fd564190808270005r23a1e175y82bf4f96b7c75073@mail.gmail.com> Hi First of all many thanks for SBE. I've been reading it carefully over the last couple of weeks (printed a copy out via Lulu) and have found it VERY useful. I think there's an error that's not listed in the current Errata. Page 226 History>>goBackward self canGoBackward ifFalse: [self error : 'Already on the ?rst element']. self skip: --2. ? self next. Those last two lines should refer to stream not self I believe. i.e. History>>goBackward self canGoBackward ifFalse: [self error : 'Already on the ?rst element']. stream skip: --2. ? stream next. Once again - many thanks for the resource. I'm recommending it to everyone ! Ian From damien.cassou at gmail.com Wed Aug 27 09:13:08 2008 From: damien.cassou at gmail.com (Damien Cassou) Date: Wed, 27 Aug 2008 09:13:08 +0200 Subject: [sbe-discussion] Re: Error on page 226 of current book (2008/05/15) ? In-Reply-To: <6fd564190808270005r23a1e175y82bf4f96b7c75073@mail.gmail.com> References: <6fd564190808270005r23a1e175y82bf4f96b7c75073@mail.gmail.com> Message-ID: <6ac749c10808270013o574b80a9r96c96ba94bd5478e@mail.gmail.com> Hi Ian, thank you for the report. I will take care of updating the book. Bye On Wed, Aug 27, 2008 at 9:05 AM, Ian J Cottee wrote: > Hi > > First of all many thanks for SBE. I've been reading it carefully over > the last couple of weeks (printed a copy out via Lulu) and have found > it VERY useful. > > I think there's an error that's not listed in the current Errata. > > Page 226 > History>>goBackward > self canGoBackward ifFalse: [self error : 'Already on the ?rst element']. > self skip: --2. > ? self next. > > Those last two lines should refer to stream not self I believe. i.e. > > History>>goBackward > self canGoBackward ifFalse: [self error : 'Already on the ?rst element']. > stream skip: --2. > ? stream next. > > Once again - many thanks for the resource. I'm recommending it to everyone ! > > Ian > > _______________________________________________ > Sbe-discussion mailing list > Sbe-discussion at iam.unibe.ch > https://www.iam.unibe.ch/mailman/listinfo/sbe-discussion > -- Damien Cassou Peter von der Ah?: ?I'm beginning to see why Gilad wished us good luck?. (http://blogs.sun.com/ahe/entry/override_snafu)