[Shootout-list] fannkuch in Scheme

Dima Dorfman d+shootout@trit.org
Fri, 24 Dec 2004 14:54:51 +0000


Isaac Gouy <igouy2@yahoo.com> wrote:
> > Attached is a fannkuch implementation in Scheme. It uses the same
> > successor algorithm as Simon Geard's f90 implementation posted on
> > Sunday, but I actually wrote this last week (it's a well-known
> > algorithm).
> 
> I haven't looked at Simon's implementation - does it follow the steps
> given in the problem description?

All the implementations follow the steps in the problem description,
but the latter doesn't specify how to generate the permuations. My
Scheme implementation and the f90 implementation posted here last
weekend generate the permuations in lexicographical order. This
algorithm is easy to implement and has reasonable computational
complexity. At least the Python implementation does something else.
The OCaml version looks like it's different from both of them, and
Nice looks even different, but I didn't look at them in detail and
might be confusing myself with the bookkeeping. I haven't tested
whether the permuation successor algorithm makes a significant
difference for execution times.

Dima.