5 ms·
My absolute favorite example of what's possible with awk is this[0] calculator from Ward Cunningham about splitting expenses on a ski trip. It's a really beaut
by liammonahan 6y ago
My absolute favorite example of what's possible with awk is this[0] calculator from Ward Cunningham about splitting expenses on a ski trip. It's a really beautiful little piece of code well-adapted to this problem.
[0] - https://c2.com/doc/expense/ https://c2.com/doc/expense/
- kqr 6y agoThis is the sort of thing us industry professionals need to study in more depth. It doesn't have the most flexible interface, but it's human-readable, and the implementation is simple, fast, and about as obviously correct as possible.
- cyrusmg 6y agoI am trying to parse the program based on the article above and comments on the link you posted. > The first occurrence of a variable name defines it as that sum. Subsequent occurrences become the stored value. With this quote in mind - why is second `SUM` reference replaced with `-138.95` and not `221.81` (stored value) ? EDIT: Never mind, now I see it's an exception on line 3.
- tekknolagi 6y agoThis reminds me of a story of a guy who wrote a whole company internal debit system like this (coffee, meals out, etc) and it turned into a currency. I feel like I either saw it here, or a similar forum. Anyone have a link? My searches have not found it...
- stuuuuuuuuu 6y agoThis one? https://royrapoport.blogspot.com/2011/05/coffee-and-its-effects-on-feature-creep.html https://royrapoport.blogspot.com/2011/05/coffee-and-its-effe...
- tekknolagi 6y agoThat's it! You found it! Thank you.
- combatentropy 6y agoI glanced through the input and output. When I got to the code, I was startled by how short it was. This page is worthy of its own post on Hacker News. I am now convinced that Ward Cunningham is a genius. I was already pretty sure after reading how he invented the wiki.