From: jatwood@cvpjaws03.dhcp.cv.hp.com (John Atwood)
Subject: Re: writing an "artful" algorithm
Date: Mon, 19 May 2003 23:19:50 +0000 (UTC)
Date: 2003-05-19T23:19:50+00:00 [thread overview]
Message-ID: <baboqm$v8t$1@cvpjaws03.dhcp.cv.hp.com> (raw)
In-Reply-To: Tvzna.1484$Kb5.65920135@newssvr12.news.prodigy.com
John Stoneham <captnjameskirk@moc.oohay> wrote:
>For those who like puzzles and have a little bit of free time, you may
> <snip>
>
>This does seem like the imperative way to work out the problem, and I
>think just about any other imperative approach would look about the
>same, even if it used vectors or records in its representation. It would
>still need to test individual digits and generate and test every
>possible combination. But what about the functional approach? Would it
>be more "artful" here? Would it even be possible to use a functional
>approach for such a problem?
Here's a functional solution to a similar problem:
http://www.cs.nott.ac.uk/~gmh/bib.html#countdown
Graham Hutton. Journal of Functional Programming,
12(6):609-616, Cambridge University Press, November 2002.
We systematically develop a functional program that
solves the countdown problem, a numbers game in
which the aim is to construct arithmetic expressions
satisfying certain constraints. Starting from a formal
specification of the problem, we present a simple but
inefficient program that solves the problem, and prove
that this program is correct. We then use program fusion
to calculate an equivalent but more efficient program,
which is then further improved by exploiting arithmetic
properties.
John
prev parent reply other threads:[~2003-05-19 23:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-17 15:12 writing an "artful" algorithm John Stoneham
2003-04-17 22:08 ` Samuel Tardieu
2003-04-17 22:17 ` Samuel Tardieu
2003-04-18 4:57 ` Steve
2003-04-18 5:51 ` tmoran
2003-04-22 20:38 ` Dan Eilers
2003-04-23 13:12 ` John Stoneham
2003-05-19 23:19 ` John Atwood [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox