Article View: comp.os.linux.misc
Article #2088Re: [OT] Dead DEC Punch card times (was Re: Taking Speedy too seriously)
From: c186282
Date: Fri, 06 Nov 2026 00:15
Date: Fri, 06 Nov 2026 00:15
48 lines
4123 bytes
4123 bytes
On 11/5/26 18:04, Lawrence D’Oliveiro wrote:
> On Thu, 05 Nov 2026 21:57:51 GMT, Charlie Gibbs wrote:
>
>> I do admit that the other extreme can become hairy. I once saw a
>> recursive macro that solved the Towers of Hanoi. It generated no
>> code; the solution was in the expanded source listing.
>
> String-based macro languages in general can be pretty hairy.
> Towers of Hanoi wouldn’t even be that hard.
>
> ----
> dnl
> dnl Example m4 implementation of the GPM example output shown on page 64
> dnl of Bryan Higman's "A Comparative Study of Programming Languages", 1st ed.
> dnl
> dnl Created 2008 September 10 by Lawrence D'Oliveiro.
> dnl
> define(`repeat', `ifelse($2, 0, `', $2, 1, `$1', `$1`'repeat(`$1', eval($2 - 1))')')dnl
> dnl repeat(str, n) outputs n consecutive repetitions of str
> define(`n', `regexp(` x one two three four five six seven eight nine ten', `^\'repeat(` [^ ]+', $1)` \([^ ]+\)', `\1')')dnl
> dnl n(i) returns the word representation of i. Need to use the "repeat" macro
> dnl because m4's regexps don't support \{n\} repeat coefficients.
> define(`cap', `regexp(`$1', `^\(.\)\(.*\)$', `translit(`\1', `a-z', `A-Z')\2')')dnl
> dnl cap(s) returns s with the first letter capitalized.
> dnl
> define(`nrverses', 10)dnl
> define(`nmen', `cap(n($1)) ifelse($1, 1, man, men)')dnl
> dnl nmen(i) outputs the phrase "<i> man/men"
> define(`tomow', ` went to mow')dnl
> define(`mow1', `tomow a meadow')dnl
> define(`firstline', `nmen($1)`'tomow,mow1')dnl
> dnl firstline(i) outputs the first line of verse i.
> define(`restlines', `ifelse($1, 1, `nmen(1) and his dog,mow1', `nmen($1)
> restlines(eval($1 - 1))')')dnl
> dnl restlines(i) outputs the remaining lines of verse i
> define(`verse', `firstline($1)
> restlines($1)')dnl
> dnl verse(i) outputs the complete verse i
> define(`verses', `verse($1)`'ifelse($1, nrverses, `', `
>
> verses(eval($1 + 1))')')dnl
> dnl verses(i) outputs the verses from i up to the last one.
> dnl here we go...
> verses(1)
Well, that's totally transparent :-)
Technical Details
Message-ID:
<rRqdnbSg7qeDgXD3nZ2dnZfqn_idnZ2d@giganews.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.nrbbs.org!border-4.nntp.ord.giganews.com!nntp.giganews.com!local-3.nntp.ord.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mailReferences:
<18dee4b6cab427fa$865$2574533$802601b3@news.usenetexpress.com> <ayudnc43iJgfVXr3nZ2dnZfqn_adnZ2d@giganews.com> <11c8mg3$2e89e$2@kst.eternal-september.org> <_ZucnafJTvBFc3r3nZ2dnZfqnPGdnZ2d@giganews.com> <11c8rq9$1e6t$1@gal.iecc.com> <WfacneJt4NA3sHX3nZ2dnZfqn_udnZ2d@giganews.com> <11c9ibo$2e740$1@dont-email.me> <11c9rph$2oln7$7@dont-email.me> <a6%FS.31515$DTve.14247@fx18.ams4> <nktvq5Fahr2U5@mid.individual.net> <11cdg7h$46jl$3@dont-email.me> <11cfg4e$or8q$1@dont-email.me> <71MGS.199928$MmU5.168803@fx44.iad> <11ciqoo$1votj$3@dont-email.me> <zZ6HS.316757$_pxc.241519@fx17.iad> <11cj21m$22bch$2@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.nrbbs.org!border-4.nntp.ord.giganews.com!nntp.giganews.com!local-3.nntp.ord.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 06 Nov 2026 00:15:26 +0000 Date: Thu, 5 Nov 2026 19:15:17 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [OT] Dead DEC Punch card times (was Re: Taking Speedy too seriously) Newsgroups: comp.os.linux.misc,comp.unix.shell,alt.folklore.computers References: <18dee4b6cab427fa$865$2574533$802601b3@news.usenetexpress.com> <ayudnc43iJgfVXr3nZ2dnZfqn_adnZ2d@giganews.com> <11c8mg3$2e89e$2@kst.eternal-september.org> <_ZucnafJTvBFc3r3nZ2dnZfqnPGdnZ2d@giganews.com> <11c8rq9$1e6t$1@gal.iecc.com> <WfacneJt4NA3sHX3nZ2dnZfqn_udnZ2d@giganews.com> <11c9ibo$2e740$1@dont-email.me> <11c9rph$2oln7$7@dont-email.me> <a6%FS.31515$DTve.14247@fx18.ams4> <nktvq5Fahr2U5@mid.individual.net> <11cdg7h$46jl$3@dont-email.me> <11cfg4e$or8q$1@dont-email.me> <71MGS.199928$MmU5.168803@fx44.iad> <11ciqoo$1votj$3@dont-email.me> <zZ6HS.316757$_pxc.241519@fx17.iad> <11cj21m$22bch$2@dont-email.me> Content-Language: en-US From: c186282 <c186282@nnada.net> Organization: wokiesux In-Reply-To: <11cj21m$22bch$2@dont-email.me> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <rRqdnbSg7qeDgXD3nZ2dnZfqn_idnZ2d@giganews.com> Lines: 48 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-Qe9NtkKjRBa7o6kdWitC/gEaoxUVUe5kk7zVZDexHXCi9VVcWvvJdm+QHWhElD1oCQDIDmVcB7jfnFz!tka/p+Q9IpboLRtQzmIT3XzE7QK0XgnBtljBcTMTS7VTg9/MBFSMNPEU1OCe2amQL98BsHLBkRg= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40