Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct
Albert van der Horst
albert at spenarnc.xs4all.nl
Sun Mar 18 12:08:59 CET 2012
In article <gR09r.22645$I33.16090 at uutiset.elisa.fi>,
Antti J Ylikoski <antti.ylikoski at tkk.fi> wrote:
>In his legendary book series The Art of Computer Programming,
>Professor Donald E. Knuth presents many of his algorithms in the form
>that they have been divided in several individual phases, with
>instructions to GOTO to another phase interspersed in the text of the
>I. e. they look like the following, purely invented, example: (Knuth is
>being clearer than me below.....)
>A1. (Do the work of Phase A1.) If <zap> then go to Phase A5,
>A2. (Do some work.) If <zorp> go to Phase A4.
>A3. (Some more work.)
>A4. (Do something.) If <condition ZZZ> go to Phase A1.
>A5. (Something more). If <foobar> then go to Phase A2, otherwise
I can rewrite this into Python in my sleep, without resorting
to formal techniques.
Instead try one of the harder algorithms like T (Toom Cook)
that must be translated to recursive functions that pass
data down. That took me quite a wile.
The correct answer is, it is just labour. Deal with it.
Note that if you want to translate it to assembler, it is
>kind regards, Antti J Ylikoski
>Helsinki, Finland, the EU
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert at spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
More information about the Python-list