[plt-scheme] Comprehension: An example with five nested loops and four guards

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Mon Jun 4 15:05:50 EDT 2007

Robby Findler skrev:
> On 6/4/07, Jens Axel Søgaard <jensaxel at soegaard.net> wrote:
>> David Einstein skrev:
>> > Does this give the set with the lowest sum?
>> Yes.
> The code may in fact produce the one with the smallest sum, but it
> looks like it would be wrong if there a set of primes that has a
> higher sum, but a lower smallest prime 

Well spotted. For a lot of the Project Euler problems you can
save time by getting an plausible answer and then check it
using their web page.

In order to make the code reflect the problem statement, we
need an "on-new-min-event" in the min-ec comprehension
in order to keep track of the which set gave the minimum.

Hmm. I think I'll rewrite min-ec.

/Jens Axel

Posted on the users mailing list.