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

In CL without the need for destructuring:

    (setf (values a b c)
          (values 10 20 30))



That's still three superfluous words. I have to agree with abritinthebay, especially when comparing with Python's destructuring, which doesn't even need brackets:

  a, b, c = 10, 20, 30


What about all those superfluous commas? I also dislike languages where expressions don't have visible bounds.


A line break isn't visible? Not by itself, I suppose, but in the code, it's hard to miss.


for what expression does the line break stand, exactly?


But why must everything be an expression?


Because anything else is a language design mistake.


Can you justify that statement empirically?


a, b, c is a tuple. Parentheses can be omitted, same as in some ML dialects:

  # let a, b, c = 10, 11, 22;;
  val a : int = 10
  val b : int = 11
  val c : int = 22

  # a, b, c;;
  - : int * int * int = (10, 11, 22)
  # (a, b, c);;
  - : int * int * int = (10, 11, 22)


Python needs a piece of whitespace on the left of the correct size and tab/space constituency, and a newline on the right.

It's ambiguous. What is the relative precedence of the comma and equal sign? You just have to know.

Lisp means never memorizing associativity and precedence tables again.


No, just the name and argument order of a bunch of functions/macros (set, setf, setq...).


> never memorizing associativity and precedence tables again.

Why is that an unambiguous benefit though?

By that logic, we ought to have parentheses around every mathematical expression as well.

I think there's a sane middle ground between forcing people to memorize endless precedence tables versus not having any implicit precedence at all.


> By that logic, we ought to have parentheses around every mathematical expression as well.

Yes we should. Some math notations are simply crazy; they make it hard to follow the semantics.

The one thing that turns me off math is the notation.

A lot of math papers don't explain their notation; that's another problem.


> Python needs a piece of whitespace on the left of the correct size and tab/space constituency, and a newline on the right.

Good luck getting your lisp code merged with mismatched tabs/spaces or everything aligned to column 0.


Better, I wouldn't call it elegant though. But better than other Lisp example in this thread.

Though realistically you're destructuring in the same way just with implicit vs explicit structure.

Practically speaking there's no difference but CL has a less clear syntax.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: