Hacker News new | ask | show | jobs
by such_a_casual 3240 days ago
Prefix notation is a problem because nothing beats the familiarity of:

    x = 10
But prefix notation is superior. You don't have to invent an order of operations out of thin air. All your functions take several arguments, not just 2. So + is now sum, - is difference, / quotient, > greater than order, etc. They aren't special. they're just like everything else.

It'll never be as familiar, but it's smarter and makes writing code easier. For example

    "hello " + name + ", welcome to the " + place +"."
    + "hello " name ", welcome to the " place "."
The reality is you want functions that work on many things, not just 2, even when you're doing math.

    1 + height + x + floor-height
    + 1 height x floor-height
infix notation does nothing to make code clearer
1 comments

Anyway, you want string interpolation for the former example anyway:

  1> (let ((name "Alice") (place "The Palace"))
       `Hello @name, welcome to @place!`)
  "Hello Alice, welcome to The Palace!"
string interpolation is compatible with Lisp designs; it is self-contained and so doesn't "disturb" the surrounding syntax with issues of precedence and associativity. The above example is from TXR Lisp which has this built in. For Common Lisp, there is the cl-interpol and other packages, and other dialects have their own solutions.
And it's pretty trivial to roll your own.