Live data from Hacker News

Clac – A command-line, stack-based calculator with postfix notation

github.com

1–10 of 29 posts

Re: Clac – A command-line, stack-based calculator with postfix notation

#5
I don't understand why things like this get posted to HN so often. This kind of program is a very common exercise in university courses and appears in countless programming books. Heck, you implemented it in C, and this exact exercise appears in K&R C.

I hope this doesn't come off as snide... I just don't understand why the author would think this is something worth showing off.

Re: Clac – A command-line, stack-based calculator with postfix notation

#6
post #5

I don't understand why things like this get posted to HN so often. This kind of program is a very common exercise in university courses and appears in countless programming books. Heck, you implemented it in C, and this exact exercise appears in K&R C. I hope this doesn't come off as snide... I just don't understand why the author would think this is something worth showing off.

Also the command dc ships with most Linuxes. It is included with the bc package.

Re: Clac – A command-line, stack-based calculator with postfix notation

#7
post #5

I don't understand why things like this get posted to HN so often. This kind of program is a very common exercise in university courses and appears in countless programming books. Heck, you implemented it in C, and this exact exercise appears in K&R C. I hope this doesn't come off as snide... I just don't understand why the author would think this is something worth showing off.

> I don't understand why things like this get posted to HN so often.

Nostalgia.

Re: Clac – A command-line, stack-based calculator with postfix notation

#8
post #6
post #5

I don't understand why things like this get posted to HN so often. This kind of program is a very common exercise in university courses and appears in countless programming books. Heck, you implemented it in C, and this exact exercise appears in K&R C. I hope this doesn't come off as snide... I just don't understand why the author would think this is something worth showing off.

Also the command dc ships with most Linuxes. It is included with the bc package.

dc exists, and is great for quick shell script math. As an interactive calculator REPL it is... not the greatest. Having the stack represented on the right gets closer to the HP 48 experience.

Re: Clac – A command-line, stack-based calculator with postfix notation

#9
post #5

I don't understand why things like this get posted to HN so often. This kind of program is a very common exercise in university courses and appears in countless programming books. Heck, you implemented it in C, and this exact exercise appears in K&R C. I hope this doesn't come off as snide... I just don't understand why the author would think this is something worth showing off.

Likewise, I don't see this replacing dc for me. The exciting thing is really the suggestion to consider what it would take to implement your own dc. Reimplementing dc was never an assignment I saw as a student, so I think it's valuable to point out that it's an interesting exercise.

Re: Clac – A command-line, stack-based calculator with postfix notation

#10
post #5

I don't understand why things like this get posted to HN so often. This kind of program is a very common exercise in university courses and appears in countless programming books. Heck, you implemented it in C, and this exact exercise appears in K&R C. I hope this doesn't come off as snide... I just don't understand why the author would think this is something worth showing off.

I'm not the author of the post, I just wrote the tool. I agree with you that it's not groundbreaking technology :-)

In fact, the code is extremely simple. As I mentioned in the README, I've used dc a lot and what I propose with clac is an improvement (for my taste) regarding the UI, as there's an always-visible representation of the stack that gets updated as you type. I recorded a short video to show it in action: http://files.soveran.com/misc/clac.mov

Post reply on HN