Hacker News new | ask | show | jobs
by bayareanative 2549 days ago
RPN FTW. Good ol' LISP. :)

In Haskell, you can turn any function into an infix operator with backquotes. As a qualitative, nonfunctional stylistic, ergonomic opinion, I find Haskell much more flexible and beautiful than the ugliness of most brace-, paren- and prolixity-heavy languages. It can present too many features for pragmatic use, orthogonal to something in another domain like Rust or Go for effective software production where features are intentionally constrained or disallowed.

2 comments

> RPN FTW. Good ol' LISP. :)

Actually Lisp uses ordinary old polish notation. Reverse Polish Notation is used by stack-oriented systems like HP calculators and Forth.

Not really; the motivating point of Łukasiewicz's notation was specifically to eliminate parentheses.
Well choosing between

(- (+ 1 2 3 4 5) 1)

and

- + + + + 1 2 3 4 5 1

The first one seems much more readable to me...

Lisp functions can take fewer or more than two arguments while many mathematical operators take only two.

And parentheses don’t serve precisely the same role in Lisp syntax than they in the more free-form world of maths.

We have macros and LISP is a building material, not a language.

One line of code is just enough to get something that works (defmacro infix [a op b] `(~op ~a ~b))

There are libraries for that too. Clojure: https://github.com/rm-hull/infix