The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Tomasz Rola <rtomek@ceti.pl>
To: tuhs@tuhs.org
Subject: Re: [TUHS] The most surprising Unix programs
Date: Thu, 19 Mar 2020 21:01:20 +0100	[thread overview]
Message-ID: <20200319200120.GB16996@tau1.ceti.pl> (raw)
In-Reply-To: <7ec47fd97b1a3d383ffed428f21f5287@firemail.cc>

On Tue, Mar 17, 2020 at 09:03:41AM -0400, ca6c@firemail.cc wrote:
> Doug McIlroy wrote:
> >dc
> >
> >The math library for Bob Morris's variable-precision desk
> >calculator used backward error analysis to determine the precision
> >necessary at each step to attain the user-specified precision of
> >the result. In my software-components talk at the 1968 NATO
> >conference on software engineering, I posited measurement-standard
> >routines, which could deliver results of any desired precision, but
> >did not know how to design one. dc still has the only such routines
> >I know of.
> 
> dc, along with ed and I guess awk if we can put it here, is one of my
> favorite Unix programs that I use daily.  I don't even have a "normal"
> calculator installed.  It just smells like Unix.

+1 for (g)awk. After learning it and for many many years treating as
"oh just a lines of text processing" tool, I have rediscovered it
about a year or two ago. It is (IMHO) a very good alternative language
for writing scripts whose complicated control flow might make sh
script error-prone and/or ugly. One such script helps me with sound
processing - doing some tests for recorded file, composing params for
invocation of ecasound (say, check if file needs to be recoded from
48kHz to 44.1kHz etc), and, whoa, invoking ecasound and streaming
bytes to stdout for ogg encoder. The script is part of a pipeline,
takes multiple filenames as args and cats them one by one, each with
the right incantation to ecasound - amplification level, freq changes,
all auto, so much modern, look ma no hands :-).

Another one is changing color temperature of my monitor. I have found
function computing RGB values in someone's code, and the colors were
not what I wanted. So the script also has some named profiles in a
hash table, where values are a line of three floats, which then gets
split()-ed and so on.

Overally, I would consider using (g)awk whenever there is a need to
invoke some commands based on quirky and complicated criteria. I am
sure the scripts could be written in "pure" sh, but something had me
step back from this.

One task I would be afraid to use awk for, is html processing. Most of
html sources I look at nowadays seems discouraging. Extracting
anything of value from the mess requires something more potent, I
think.

> There is something sexy about reverse Polish notation.  I really do
> encourage everyone reading this to try dc as their "desk calculator"
> for some time.

For "desk calculator" I am using clisp, a (relatively) lightweight
Common Lisp interpreter. I got hooked up after discovering that CL had
quite a few numeric types - real rational numbers. making 1/3 and 1/10
easy to have in computer, few floating types, "unlimited" ints,
complex numbers. One has to be wary about unintended type conversion,
but otherwise I found it very useful for my needs.

And for "smart calculator" in a pocket, I would like to use gforth
implementation for Android. Once I make myself comfy enough with Forth
to not have to poke around manual all the time.

-- 
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             **

  parent reply	other threads:[~2020-03-19 20:11 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13 23:31 Doug McIlroy
2020-03-14  0:40 ` Dave Horsfall
2020-03-14 11:30 ` Harald Arnesen
2020-03-14 12:24   ` Clem Cole
2020-03-15 22:01     ` Rob Pike
2020-03-15 22:14       ` Larry McVoy
2020-03-15 23:34         ` Warner Losh
2020-03-16  2:45           ` Anthony Martin
2020-03-15 22:30       ` Clem Cole
2020-03-15 23:20       ` Dave Horsfall
2020-03-16  0:56         ` Rob Pike
2020-03-20 23:20           ` Dave Horsfall
2020-03-20 23:35             ` Toby Thain
2020-03-21  0:34             ` Rob Pike
2020-03-17 13:03 ` ca6c
2020-03-17 13:30   ` Andy Kosela
2020-03-17 14:53     ` Cág
2020-03-17 14:57       ` Larry McVoy
2020-03-17 14:59         ` Arrigo Triulzi
2020-03-17 15:40   ` Steve Nickolas
2020-03-17 22:28   ` Dave Horsfall
2020-03-18  0:17     ` Jon Steinhart
2020-03-18  3:28       ` Dave Horsfall
2020-03-18  8:40     ` arnold
2020-03-19 12:26     ` Mike Markowski
2020-03-19 21:31       ` Dave Horsfall
2020-03-20 11:48         ` paul
2020-03-20 15:40           ` Grant Taylor via TUHS
2020-03-20 16:40             ` Jon Steinhart
2020-03-20 17:23               ` Grant Taylor via TUHS
2020-03-20 18:43               ` Rich Morin
2020-03-19 20:01   ` Tomasz Rola [this message]
2020-03-19 20:57 Nelson H. F. Beebe
2020-03-19 21:18 ` Tomasz Rola
2020-03-20  7:14 ` arnold
2020-03-20  7:49   ` Thomas Paulsen
2020-03-20  8:18     ` arnold
2020-03-20 14:03 Noel Chiappa
2020-03-20 14:08 ` Richard Salz
2020-03-20 14:52   ` Larry McVoy
2020-03-20 14:58     ` Dagobert Michelsen
2020-03-20 15:05       ` Richard Salz
2020-03-20 22:09       ` Mike Markowski
2020-03-20 15:03     ` Gregg Levine
2020-03-20 15:05       ` Chet Ramey
2020-03-20 22:06     ` Dave Horsfall
2020-03-21  4:59     ` Wesley Parish
2020-03-20 21:57   ` Dave Horsfall
2020-03-22 18:05     ` Tony Finch
2020-03-20 15:07 ` Nemo
2020-03-20 19:03   ` Adam Thornton
2020-03-20 16:07 ` Grant Taylor via TUHS
2020-09-13 15:44   ` Juergen Nickelsen
2020-03-21  1:12 Noel Chiappa

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=20200319200120.GB16996@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).