News for hackers. Stuff that matters.
Re:Playing with Syntax by kazinator on Saturday August 20, 2016 @12:49PM (#12327303)
That assignment has 9 pieces of extra syntax above a b c 10 20 30. By contrast, (setf a 10 b 20 c 30) has only three: two parens and setf. Let's count the crumbs:

  [a, b, c] = [10, 20, 30]
  1 2  3  4 5 6  7   8   9
In Common Lisp, you an express that 10 20 30 should go to a b c using values:

  (setf (values a b c) (values 10 2 30))
That still has fewer overhead tokens!

  (setf (values a b c) (values 10 2 30))
  1 2   3   4          5 6            78
If they are bother make yourself

  (vsetf (a b c) (10 20 30))
This is easy to implement in a quick and dirty way:

  (defmacro vsetf (places exprs) `(psetf ,@(mapcan #'list places exprs))

  (macroexpand-1 '(vsetf (a b c) (1 2 3)))
  -> (PSETF A 1 B 2 C 3)
psetf is probably a good choice here since it is probably best for the construct to have parallel semantics. That is to say, we want, for instance, to be able to exchange variables with it:

  (vsetf (x y) (y x))
which will work thanks to psetf.

We could huff and puff a little harder in the macro and make it work like

  (vsetf x y = y x)
Re:Playing with Syntax by smallnamespace on Saturday August 20, 2016 @01:14PM (#12327427)
Token-counting is a strawman here; you can use more tokens and still have something that's easier for a person to read.

I think his point was that Lisp pushes syntactic minimalism to an extreme, but all the complexity then gets shoved into what your keywords are doing. You're not eliminating complexity, you're just moving it somewhere else. Judicious introduction of syntax + keywords can be better than depending on magic keywords/macros/symbols alone.

A concrete example of this comes from math--while we could write every integral as

  (Integral lbound ubound body differential)
I'd argue that our usual integral notation is both more readable and compact because the spatial positioning of the elements has semantic meaning.

The tradeoff is as you introduce more syntax, it's harder to get a macro system as elegant as Lisp's; Lisp macros are relatively easy to write because s-exprs are simple. But we shouldn't pretend that there's no downside to a minimal syntax--otherwise we would all be coding in pure untyped lambda calculus or Brainfuck.

Re:Playing with Syntax by kazinator on Saturday August 20, 2016 @06:48PM (#12328599)
Yes, you're eliminating complexity. Because there is a fixed amount of complexity in the semantics of the assignment operation itself. Having to parse some syntax with precedence and whatnot is extra complexity that doesn't further the goal of assigning to those three variables.

The ideal syntax for performing some operation O on entities X, Y and Z consists only of the symbols O, X, Y an Z. We need the parentheses to delimit that as an expression among other symbols.

Re:Playing with Syntax by smallnamespace on Saturday August 20, 2016 @07:41PM (#12328801)
> The ideal syntax for performing some operation O on entities X, Y and Z consists only of the symbols O, X, Y an Z

That's simply begging the question.

That viewpoint only makes sense if all code is most parsimoniously broken down into its parse tree, but I don't think that's been shown.

When all you have is a hammer (even a slick, homoiconic hammer), everything looks like a nail.

> We need the parentheses to delimit that as an expression among other symbols.

There are other ways to delimit expressions as well (e.g. implicitly with precedence, with whitespace, with HTML tags, with curly braces, etc.); why is Lisp's way the one true way?

Re:Playing with Syntax by int_19h on Saturday August 20, 2016 @08:54PM (#12328979)
All the extra punctuation in syntax is redundant in the same way serifs are redundant on letters - sure, you don't need them to be able to figure out what the letters are, but having them there makes it easier and increases your reading speed, despite the increased complexity of shapes.
Re:Playing with Syntax by kazinator on Saturday August 20, 2016 @10:57PM (#12329200)
When was the last time you saw a freeway sign in Times Roman or Garamond or their ilk? Or any other public signage related to transportation.

All modern console fonts for writing code are sans-serif.

(I'm using Microsoft's Consolas, even on GNU/Linux systems).

A number of times in the past I tried finding a serif font for editing code, just for shits and giggles. And, by golly, that's precisely all it was good for.

If you want squiggly high frequency noise in your code, you can just switch to that type of font; no need to foist that into the programming language.

Re:Playing with Syntax by int_19h on Sunday August 21, 2016 @01:50AM (#12329598)
When was the last time you've read a book typeset in a sans serif font?

For clarification, I wasn't suggesting to use serifs for coding. It's not necessary there, because it's not the letters themselves that need to catch the eye, but code structure. All those square and curly braces, commas etc do just that. As does indentation, but using indentation for everything, the way Lisp tends to do, blurs too many distinctions.

S-exprs are great for machines, just as binary is - it's simple and consistent and lacks pointless redundancy. But humans aren't machines - redundancy is good for us sometimes.

Re:Playing with Syntax by abritinthebay on Sunday August 21, 2016 @12:58PM (#12331608)
> When was the last time you saw a freeway sign in Times Roman or Garamond or their ilk? Or any other public signage related to transportation.

Non-sequitur - serifs are for small, black-on-white, type as visual hinting. You'd not expect serif type on road signs.

All you've done is demonstrate ignorance of typography

Re:Playing with Syntax by abritinthebay on Sunday August 21, 2016 @12:55PM (#12331592)
That's a lot of work to demonstrate that Lisp's syntax is less elegant than freaking ES6.

> TThat assignment has 9 pieces of extra syntax

Seeing as we're not playing Code Golf that does t really matter does it? What it is is clearer, easier to understand, and actually built into the language.

Lisp is many things, syntactically elegant isn't one of them.

Re:Playing with Syntax by kazinator on Sunday August 21, 2016 @02:51PM (#12332170)
I feel that I hadn't seen true beauty in a text editor window until I got involved with Lisp, and that EczemaScript is designed by imbeciles.

I'm willing to try to put some kind of numbers on my point of view. Basically, it boils down to token counts and the presence of implicit associativity and precedence rules.

We can remove four square parentheses from the [ a, b, c ] = [ 1, 2, 3 ] assignment, thereby significantly reducing the verbiage. However, we end up with ambiguity. There is no universal precedence between comma and assignment. For instance, in C (a language which indirectly inspired the syntax of ES), it is the other way: the expression a, b, c = 1, 2, 3 in C will perform only the c = 1 assignment. It's good that ES spends these extra tokens to reduce ambiguity here.

Every extra token should count as one demerit point. Then, every instance in a sentence where an implicit rule must be invoked to disambiguate the parse should result in multiple demerits determined according to how the smallest number of grouping tokens would have to be inserted to remove the ambiguity. (That's being generous, because it doesn't take into account the work of determining the parse and doing the insertion.)

So for instance "Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo" has a minimal number of tokens to express its meaning (which is good), but there is a significant cognitive load to figure out its structure from all the implicit grammar rules (bad). If we insert the parentheses we get "((Buffalo buffalo) (Buffalo buffalo) buffalo) buffalo (Buffalo buffalo)".

Some functional languages have this "buffalo disease"; strings of words are just catenated, and working out all the partial applications that are buried in there and whatnot is a hairball.

Re:Playing with Syntax by abritinthebay on Sunday August 21, 2016 @04:59PM (#12332723)
> Basically, it boils down to token counts and the presence of implicit associativity and precedence rules.

That's... a really arbitrary and contrived presumption. Not to mention presuppositional (and circular) in nature. "I define what makes a language beautiful as what Lisp is best at, therefore lisp is most beautiful."

It's things like this which cause Lisp evangelists to not get taken seriously.

Based on your comparison anyhow Python is much better with it's Tuples (ie - a, b, c = 1, 2, 3) and lisp would be fundamentally worse.

Re:Playing with Syntax by kazinator on Monday August 22, 2016 @01:43AM (#12334342)
I see; so when you say things like 'Lisp is many things, syntactically elegant isn't one of them' you are taken seriously, whereas if I say the opposite I am not; and it's because I have tried to reflect over my biases, and quantify them in some sort of objectively evaluable terms.
Re:Playing with Syntax by abritinthebay on Wednesday August 24, 2016 @02:00PM (#12353939)
No, it's when you define "beautiful" as "equivalent to lisp syntax" that you are not taken seriously.

Which you did. So you weren't.