4 ms·
Expense Calculator (1981)
- fusiongyro 10y agoSo 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 10y agoI'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 10y agoI've been using org-mode for about a year and I haven't got a clue what you're talking about.
- throwanem 10y agoI'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
- skolos 10y agoThis 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-liner-competition-winners/ http://blog.wolfram.com/2016/11/09/the-2016-wolfram-one-line...
- gregable 10y agoI'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/
- glhaynes 10y agoFor a modern take on this style of thing, see Calca http://calca.io/ http://calca.io/
- guffins 10y agoSee also: Numi and Soulver. http://www.acqualia.com/soulver/ http://www.acqualia.com/soulver/ https://numi.io/ https://numi.io/
- ben174 10y agoalso the Jupyter Notebook (Formerly known as the IPython Notebook) https://ipython.org/notebook.html https://ipython.org/notebook.html
- OrwellianChild 10y agoAnother approach is InstaCalc (https://instacalc.com/ https://instacalc.com/).
- mbrumlow 10y agoThis was the guy who also made the first wiki. Also note his 2 letter domain name.
- kristopolous 10y agothere's this appreciation for programming that many lost when computers became fast.
- geff82 10y agoWhat a beautiful program. A beauty.