
Expense Calculator (1981) - galfarragem
http://c2.com/doc/expense/
======
skolos
This reminds me Wolfram one-liner competitions [1]: "Participants in the
competition submit 128 or fewer tweetable characters of Wolfram Language code
to perform the most impressive computation they can dream up"

[1] [http://blog.wolfram.com/2016/11/09/the-2016-wolfram-one-
line...](http://blog.wolfram.com/2016/11/09/the-2016-wolfram-one-liner-
competition-winners/)

------
fusiongyro
So inspiring! Makes me pine for more exploratory programming. Nowadays this
would be done with a spreadsheet, which seems like such overkill when you
compare to this tiny bit of awk. A really pretty and concise demonstration of
a completely different way to compute.

~~~
throwanem
I'd do it in org-mode, with a table of data and a short code block to do the
summing. (Probably not in awk, although it's probably an option; most things
are. Table formulas are also an option; I don't use them as often, but for
this they're a good fit.)

It's a great environment for exploratory programming, not least because it
abstracts away tedious stuff like file marshaling. You name your data source,
bind it to a variable name in the code block header, and then just use it. A
data source can be another code block, too, so complex multistage transforms
are still easy to express.

(It's also great for producing a throwaway prototype to validate an idea and
demonstrate the result, without ever having to fear you'll be asked to promote
it into production. When the first step in doing that is to install Emacs,
even the most gung-ho manager grasps that this is the wrong shortcut to take.)

~~~
fusiongyro
I've been using org-mode for about a year and I haven't got a clue what you're
talking about.

~~~
throwanem
I've been using it for quite a while longer than that, and I'm still
discovering new functionality on a regular basis.

If you're unfamiliar as yet with tables and source blocks in org-mode, you're
missing out on a fair bit that might be of use to you. Tables support a wide
array of functionality that normally requires a dedicated spreadsheet tool or
custom code, and inline evaluation of source blocks enables a wide array of
functionality around exploratory and literate programming. I use both almost
daily, and the quality of the results and the speed with which they're
produced regularly astonishes my colleagues, who are not familiar with such
powerful tools and the capabilities they confer.

(And lest I be perceived as bragging in this last claim, let me hasten to note
that I'm not talking up _myself_ \- I'm no blazing fireball in the brains
department, and as serious Emacs users go I'm barely more than a tyro - but
rather talking up the amazing things which even someone barely more than a
tyro can achieve with org-mode, and the efficiency with which such a person
can do so.)

Take a quick look, if you care to, at the relevant [1] sections [2] of the
manual. Perhaps you'll find these tools useful! And if not, then at least
you'll have some better idea of the superpowers which rest at your very
fingertips, should you in future find yourself with a need to lay your hands
upon them.

[1]
[http://orgmode.org/manual/Tables.html](http://orgmode.org/manual/Tables.html)

[2] [http://orgmode.org/manual/Working-With-Source-
Code.html](http://orgmode.org/manual/Working-With-Source-Code.html)

------
mbrumlow
This was the guy who also made the first wiki. Also note his 2 letter domain
name.

------
kristopolous
there's this appreciation for programming that many lost when computers became
fast.

------
glhaynes
For a modern take on this style of thing, see Calca
[http://calca.io/](http://calca.io/)

~~~
guffins
See also: Numi and Soulver.

[http://www.acqualia.com/soulver/](http://www.acqualia.com/soulver/)

[https://numi.io/](https://numi.io/)

~~~
ben174
also the Jupyter Notebook

(Formerly known as the IPython Notebook)

[https://ipython.org/notebook.html](https://ipython.org/notebook.html)

~~~
jamesrom
I guess it's also worth mentioning Tydlig.

[http://tydligapp.com/](http://tydligapp.com/)

~~~
brians
I would love to see this example worked out in any of these---including credit
for the phone calls. I think they're all trying, but miss the power of awk's
simplicity.

------
geff82
What a beautiful program. A beauty.

------
gregable
I'm impressed by your awk sir!

I wanted to also mention that someone has built a handy web app for this kind
of accounting that I use for similar trips at
[https://kittysplit.com/](https://kittysplit.com/)

