Evolutionary algorithm: Difference between revisions

Content added Content deleted
Line 4,552: Line 4,552:


=={{header|m4}}==
=={{header|m4}}==
This is written in POSIX m4, but seems to run best in GNU m4. You may, like I, lose patience waiting for it to get that last character. But I have tested that the program terminates, by running it with a one-character target. :)
This is written in POSIX m4, but seems to run least annoyingly in GNU m4. (For instance, OpenBSD m4 may resist attempts to use the interrupt key.)

You may, like I, lose patience waiting for it to get that last character. But I have tested that the program terminates, by running it with a one-character target. :)


Note that it writes to a file called ‘__random_number__’. The random number generator here is the best I have come up with that works in all the m4 implementations I have installed. (Something using sysval did not work in OpenBSD m4.)
Note that it writes to a file called ‘__random_number__’. The random number generator here is the best I have come up with that works in all the m4 implementations I have installed. (Something using sysval did not work in OpenBSD m4.)


This is not the best use of m4, and I am far from an m4 guru, but it hardly seemed likely anyone else was going to write an m4 example for this task. The better my m4 skills, the better I am going to be at ''everything'' that can be preprocessed. So I wrote this.
This is not the best use of m4, and I am far from an m4 guru, but it seemed unlikely anyone else was going to write an m4 example for this task. The better my m4 skills, the better I am going to be at ''everything'' that can be preprocessed, and at GNU Autotools (which, unlike many, I like a lot). So I wrote this.


<lang m4>divert(-1)
<lang m4>divert(-1)