News for hackers. Stuff that matters.
Re:The Lisp Curse by Peaker on Saturday April 16, 2011 @08:19AM (#2453815)
Familiarity is probably the prime factor in readability. And it is indeed a subjective one.

But there are also objective factors.

Infix function application allows for easier visual parsing of the expression tree's components. There's a reason mathematicians have been using infix notation for centuries before we had arbitrary other constraints for choosing notation.

In fact, if you look at mathematicians' notation, you will see that not only is it horizontally infix (arguments left and right of the function), it is also vertically infix, and arguments are placed above and below (Sigma, Integrals, etc.).

Re:The Lisp Curse by silentbicycle on Saturday April 16, 2011 @10:12AM (#2453972)
People have come up with many rationalizations, but really, anything that doesn't have a mostly C/Java-style syntax just pisses off the majority of programmers.

When you look at languages that actually, consistently use infix and mathematical notation (http://nsl.com/k/ray/rayq.k), they seem to give most programmers fits.

Infix also only really works for unary and binary operators, of course.

Re:The Lisp Curse by forensic on Saturday April 16, 2011 @03:26PM (#2454641)
since 99.9% of every language is in prefix notation i cant buy this.

when mathematicians type f(x,y) they are using prefix notations.

likewise when programmers type run(x, y);

Anecdotally, most advanced mathematicians prefer Lisp because it is more conducive to a mathematical way of thinking. I am a very mathematical programmer and I prefer lisp specifically because I don't have to deal with operator precedence. Everytime you use infix notation you introduce a bunch of unnecessary complexity and often you complicate the ability to use simple recursion.

Gregory Chaitin, eminent mathematician, writes his proofs in Lisp for a reason.

Is it truly easier to write

   print(a + " " + b + " " + c + " "); 
rather than

   (print a " " b " " c " ")
?

I greatly prefer the latter. The first one is weighed down with unnecessary special cases, unnecessary complexity.

The benefits of Polish notation are apparent with math as well. You don't need to reformulate the entire calculation and figure out messy operator precedence rules when you want to add a term. I think RPN lends itself to bug free code and easy modifiability.

To each his own I suppose. C-syntax to me is completely nonsensical and I don't see what problem it is meant to solve. I'm sure Russians view the Latin alphabet in the same way though.

Re:The Lisp Curse by Peaker on Sunday April 17, 2011 @10:26AM (#2456182)
Mathematicians have few prefix functions. Most functions are infix and many in more than one dimension.

I think a statement like "Most advanced mathematicians prefer Lisp" is pretty extraordinary and demands extraordinary citations.

Your comparison was dishonest, as you compared manual concat and print with a function that concats and prints. You really meant to compare full infix (e.g: in Haskell):

    print $ a ++ " " ++ b ++ " " ++ c ++ " "
with full prefix:

    (print (++ a (++ " " (++ b (++ " " (++ c " "))))))
Which do you find more readable?

The anti-precedence notion behind putting () around each application requires parenthesis even when associativity laws show that there is absolutely no difference between difference precedence interpretations. In this sense, the () are pure noise in this example.

Of course, if you use ++ so many times, you'd prefer to just use (in Haskell) something like:

    print . intersperse " " $ [a, b, c]
Lisp's print has to embed the concatenation of its arguments or else it would look as horrible as shown above. It is still disingenuous to compare it as equal.
Re:The Lisp Curse by mcn on Sunday April 17, 2011 @08:42PM (#2457499)
One consequence of the parenthesis and prefix notation is that n-ary operators are idiomatic in lisps. So, the above example would more likely be written:

(print (++ a " " b " " c " "))

Re:The Lisp Curse by Peaker on Wednesday April 20, 2011 @07:32AM (#2466154)
For flat expressions, prefix is fine, and using n-ary operators is a great way to flatten many trees. n-ary operators cannot flatten every tree, though. When your tree isn't flat, and is built from primarily binary operators, infix makes the tree structure more apparent. The way we would draw trees on paper is how it would appear in the infix expression.