From: Tomasz Rola <rtomek@ceti.pl>
To: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: [TUHS] Re: Line Numbers Before SysIII nl? BSD num?
Date: Thu, 28 Jul 2022 02:30:14 +0200 [thread overview]
Message-ID: <20220728003014.GB6195@tau1.ceti.pl> (raw)
In-Reply-To: <20220724190253.GA23421@tau1.ceti.pl>
On Sun, Jul 24, 2022 at 09:02:53PM +0200, Tomasz Rola wrote:
> On Sat, Jul 23, 2022 at 08:00:10AM -0400, Dan Cross wrote:
> > On Sat, Jul 23, 2022 at 7:20 AM John Cowan <cowan@ccil.org> wrote:
> [...]
> > > An obvious approach, which would leave no real traces in documentation, would be:
> > >
> > > $ awk '{print NR, $0}'
[...]
> > > $ awk '{printf("%6d\t%s\n", NR, $0)}'
[...]
> > Yes, but awk wasn't widely available until 7th edition. I imagine work
> > on it began before `num` in 2BSD, but few outside of Bell Labs would
> > have seen it prior to 1978 or so.
[...]
> $ cat c.lisp | sed -e '{=;}' | sed -e 'N;s/\n/ /'
Ok, so maybe this is no longer very interesting subject, but I
recalled there was once a language named SNOBOL.
Wikipedia says, sed was written around 1974 [1] and about SNOBOL it
says, the language was being taught [2] in the late 1960s and early 1970s
in universities, so I guess it was quite popular. I wonder if it was
ported to Unix early enough to help before sed became available?
Anyway, I have got Phil Budne's implementation [3] and after usual
drill (configure, make, make install, stow) I could do this:
$ snobol4 -b -L ./numlines02.sno < numlines02.sno
1 lnum = 0
2 loop lnum = lnum + 1
3 output = lnum " " input :s(loop)
4 end
The first version did not work so well:
$ snobol4 -b -L ./numlines01.sno < numlines01.sno | head -8
1 lnum = 0
2 LOOP line = INPUT
3 * Here: detect EOF (how?) and jump to : END
4 lnum = lnum + 1
5 OUTPUT = lnum " " line : S(LOOP)
6 END
7 END
8 END
As I already have understood, even after reaching end of input, the
INPUT statement keeps returning last line read, counter keeps
increasing and last line is being written out for infinity. I have not
read any serious docs on SNOBOL yet, so I have no idea how to make the
'01' version work, but this is of rather small importance to the list.
However, since [2] claims SNOBOL was written in Bell Labs, just like
AWK and sed, so perhaps they could be using SNOBOL?
[1] https://en.wikipedia.org/wiki/Sed
[2] https://en.wikipedia.org/wiki/SNOBOL
[3] http://www.regressive.org/snobol4/
--
Regards,
Tomasz Rola
--
** A C programmer asked whether computer had Buddha's nature. **
** As the answer, master did "rm -rif" on the programmer's home **
** directory. And then the C programmer became enlightened... **
** **
** Tomasz Rola mailto:tomasz_rola@bigfoot.com **
next prev parent reply other threads:[~2022-07-28 0:30 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-23 2:57 [TUHS] " segaloco via TUHS
2022-07-23 5:56 ` [TUHS] " markus schnalke
2022-07-23 7:55 ` segaloco via TUHS
2022-07-23 11:01 ` Dan Cross
2022-07-23 11:20 ` John Cowan
2022-07-23 12:00 ` Dan Cross
2022-07-23 12:49 ` Norman Wilson
2022-07-23 13:20 ` Rob Pike
2022-07-23 13:36 ` Ralph Corderoy
2022-07-23 14:33 ` John Cowan
2022-07-24 19:45 ` Warner Losh
2022-07-24 20:33 ` segaloco via TUHS
2022-07-24 21:04 ` Warner Losh
2022-07-23 17:35 ` Clem Cole
2022-07-23 18:40 ` Phil Budne
2022-07-23 18:51 ` Nelson H. F. Beebe
2022-07-23 19:07 ` Douglas McIlroy
2022-07-24 19:02 ` Tomasz Rola
2022-07-28 0:30 ` Tomasz Rola [this message]
2022-07-28 1:03 ` Phil Budne
2022-07-28 4:13 ` [TUHS] SNOBOL and RATSNO William H. Mitchell
2022-07-29 4:28 ` [TUHS] " Dave Horsfall
2022-07-29 5:07 ` Tomasz Rola
2022-08-09 5:12 ` Jonathan Gevaryahu
2022-08-09 6:11 ` Rob Pike
2022-08-09 13:34 ` Clem Cole
2022-08-09 15:15 ` Andrew Hume
2022-08-09 18:26 ` Clem Cole
2022-08-09 18:52 ` Tom Teixeira
2022-08-09 21:25 ` Rob Pike
2022-08-09 15:39 ` Richard Salz
2022-08-09 13:56 ` Larry McVoy
2022-08-09 16:45 ` William H. Mitchell
2022-07-29 0:22 ` [TUHS] SNOBOL and progeny [Was: Re: Re: Line Numbers Before SysIII nl? BSD num?] Stuff Received
2022-07-29 5:01 ` [TUHS] " Charles H. Sauer
2022-07-29 14:07 ` John Cowan
2022-07-29 15:37 ` Dave Plonka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220728003014.GB6195@tau1.ceti.pl \
--to=rtomek@ceti.pl \
--cc=tuhs@tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).