Hacker News new | past | comments | ask | show | jobs | submit login

The only reason stack-based languages don't seem like alien tech to me was because of the HP48G+ graphing calculator I had in high school.

> Uiua can be embedded in Rust programs as a library.

Cool! I was wondering if there was any viability beyond short scripts.




I still use reverse polish calculator (on my phone) but I'm not used typing it left to right but executed right to left.

For example in uiua:

    * + 1 2 5
Pushes 5 on the stack, then pushed 2, then pushes 1. Then pops 1 and 2 adds them together and pushes 3, then pops 3 and 5 and multiplies then together

Reverse polish:

    5 2 1 + *
EDIT: it does makes sense in the context of an array language


The uiua version makes more sense to me than the other even without arrays. It's closer to how my brain wants to understand what is happening: "multiply (the result of...) and 5" instead of "5 (2 and 1 added) multiplied."

The latter is kinda like "the old man the boat" where information occurring later in time changes the meaning of what comes prior.

I'm sure once things get complicated enough I would understand neither RtL or LtR with equal confusion, but the smaller cases seem very readable.


Interestingly the uiua order is the same as lisp (if you add some parenthesis)

    (* (+ 1 2) 5)


Out of interest, which calculator do you use for your phone?

For whatever reason over 90% of them have the same silly design flaw that pressing 'log' just appends 'log(' to whatever is in screen, which makes no sense. It effectively makes it impossible to ever calculate the logarithm of something.


HiPER Calc Pro

I mostly use the RPN mode though.

In expression mode you're supposed to first enter log and then the inner expression


Ah thanks, looks like it has some interesting features. They seem to have chosen to add an 'Ans' variable in there, which I suppose also works. At least it avoids the issue where you calculate something, need its logarithm, and you just can't.

For now I'm using RealCalc, which is about the only one that I can find that has a 'normal' calculator mode (i.e. infix for binary operators, suffix for unary). Though it also has an RPN mode, which is quite useful.


Yup, UIUA is Polish notation rather than Reverse Polish notation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: