Larry McVoy wrote
Well, we had begin and end blocks. And other than
that, the whole thing
is a wad that is called per line. That was definitely awk inspired.
The way I have used m4, a program is executed just once from top to bottom.
There is no input file. Another way to describe it is that the program is
the input file, which happens to have some program elements interspersed.
But m4 never acts as awk does, running the whole "wad" on each line of
a separate input file.
Of course, one often puts definitions in one file, and "data" in another
and catenates them. Then, however, it is only convention--not language
design--that keeps the program and data separate. In awk, the
separation is absolute.
I'm surprised you see lisp and haskell. The
language came from me
and I've never touched haskell and I tried to like lisp, I really
did, but it never grew on me. Care to explain why you saw that?
The parenthesized decomposition of a list comes straight out of Lisp,
with car-cdr terminology (referring to parts of an IBM 700-series word)
modernized to Haskell's more intuitive head and tail. The functional
style of programming imitates Haskell within the confines of m4 syntax,
but of course. Lisp founded the functional tradition.
The word "atom" is borrowed from Lisp, "foldl", "foldr", and
"zip" come
from Haskell.
Doug
On Mon, Jul 21, 2025 at 9:28 AM Larry McVoy <lm(a)mcvoy.com> wrote:
>
Well, we had begin and end blocks. And other than
that, the whole thing
is a wad that is called per line. That was definitely awk inspired.
>
I'm surprised you see lisp and haskell. The
language came from me
and I've never touched haskell and I tried to like lisp, I really
did, but it never grew on me. Care to explain why you saw that?
>
> For what it is worth, nobody cares because all that code is dead, but
> I'm proud of that little language, it's miles and miles beyound what
> SCCS could do. I whipped up that json dspec pretty quickly and my
> memory is it just worked, we didn't have to go back and fix anything.
>
> And it is fast. It used to be lex/yacc but that was too slow so Rob
> rewrote it as a recursive-descent parser that was boatloads faster.
> We actually used that language quite a bit.
>
> On Mon, Jul 21, 2025 at 07:19:00AM -0400, Douglas McIlroy wrote: > No awk
> at all. Much imitation of Lisp and Haskell > > On Sunday, July 20, 2025,
> Larry McVoy <lm(a)mcvoy.com> wrote: > > > On Sun, Jul 20, 2025 at
07:06:38PM
> -0700, Larry McVoy wrote: > > > On Sun, Jul 20, 2025 at 08:30:45PM -0400,
> Douglas McIlroy wrote: > > > > I just posted the most heavily commented
> code I have ever written. > > > > It's a radical (mis?)application
of m4,
> which is about as inscrutable > > > > as any language short of APL. The
> ratio of comments to code is more > > > > than 3:1. > > > >
It's at
>
www.cs.dartmouth.edu/~doug/barem4.m4. 3:1 may be > > > > overkill, but
> I think 2:1 would not be unreasonable. > > > > > > > > Doug
> > > > > >
> Whenever I see something like this, it reminds me of one of my engineers >
> > > who said you couldn't make BK produce json out put. > > >
> > > Hold
> my beer. > > > > > >
http://mcvoy.com/lm/bkdocs/dspec-changes-json-v.txt
> > > > > > > It's a lot less miserable than the m4 (and
I'm a fan of m4).
> > > > > It's pretty awk inspired. > > -- > > --- >
> Larry McVoy
> Retired to fishing > >
http://www.mcvoy.com/lm/boat > >
>
> --
> ---
> Larry McVoy Retired to fishing
http://www.mcvoy.com/lm/boat