Lurker News

Comments (134) 36 threads

Show all comments

Showing thread 6 of 36

lispm3 replies#
> Most programming languages have several syntax rules. Lisp has one: everything is a list.

Oh, not again.
The author is confusing s-expression syntax with Lisp syntax. Even s-expressions are more than lists (conses, cyclic conses, symbols, vectors, strings, various numbers, structures, ...) and the s-expression reader knows about more than pure s-expressions - for example comments.
Not every s-expression is a valid Lisp expression. For example (let "let") is not a valid Common Lisp expression. The syntax for LET is:

    let ({var | (var [init-form])}*) declaration* form* => result*
This is also using the syntax definition for 'declaration' and 'form'.

Lisp has built-in syntax (provided by special operators in Common Lisp) and arbitrary complex syntax provided by macros.
This is valid for other languages with a notation based on s-expressions, like Scheme or Clojure.

chrisoakman1 reply#
I can assure you the author of Parinfer is aware of this distinction ;)

That sentence is an oversimplification to give context to the rest of the content in that section. Should probably have an asterisk to clarify.

lispm1 reply#
It's one of the sentences which creates endless confusions and a false image of Lisp. 'Everything is a list'. Oh, Lisp has only one data structure? Lisp is difficult to read, because it has no other syntax? Lisp is a primitive language and not usable for real programmers... etc. etc. It also creates the impression that even proponents of Lisp-like languages don't actually understand the basics...
oconnore6 replies#
Who is endlessly confused? Who suspects that the author of a neat lisp editor plugin has never written a non-trivial line of Common Lisp, Clojure, or Scheme? What are the chances that people in either category are also curious and excited to experiment with novel editing techniques?

Continue this thread — 6 replies

Blackthorn3 replies#
We all knew what it meant, including the author. This is pointlessly pedantic.
lispm1 reply#
It's not. Explain Lisp to people not by treating them as idiots who won't understand that not everything is a list. There are numbers, vectors, strings, and various other forms of syntax in Lisp.

   (john "123" 1)  consists of a list, a symbol, a string, an integer

   |hi there|  is a symbol

   #*1010101011  is a bit vector

   #2A((1 1 1) (1 1 1))   is a 2d array
and so on.

Also look up the current Scheme report and see its syntax definition. 'Everything is a list' is fooling the reader and treating him/her like an idiot.

munificent5 replies#
I'm pretty sure people understand that "everything is a list" doesn't mean there are no primitive literal types in the language.

Continue this thread — 5 replies

spopejoy#
Hardly "pedantic" to point out imprecise language in a post about parsing source code. It's hilariously wrong when you consider the author's focus on Clojure, which introduces all sorts of wonky syntax.

Indeed the article begs for potshots from smug lisp weenies:
1) It's clearly talking about Clojure, yet leads with "Let's simplify the way we write Lisp". Them's fighting words in the Lisp corral.
2) Paredit clone, but only acknowledges that for animations.
3) No emacs version! (Understandable given #2 however)

nickpsecurity#
I'm the first to call out grammar nazi's and pedantic crap. Despite that, lispm is right to call it out for a correction. It's a factually inaccurate statement that's gives non-LISP readers a misleading impression about what the language and its machine code are likely capable of. It's also spread like wildfire due to constant repetition as lispm noted.

So, it's worth mentioning and replacing with something more accurate.

coldtea2 replies#
>The author is confusing s-expression syntax with Lisp syntax.

Then again what he says is true for 99% of the cases, and a good simplification.
>Even s-expressions are more than lists (conses, cyclic conses, symbols, vectors, strings, various numbers, structures, ...)
Still expressed as lists when it comes to the syntax level.

lispm1 reply#
> Then again what he says is true for 99% of the cases, and a good simplification.

It's not. Read it slowly: only a subset of s-expressions are valid Lisp programs. Examples for invalid Lisp programs, even though valid s-expressions:

    (cl:if x > 1 t nil)    ; IF takes 2 or three forms

    ((cl:lambda) (a) a)    ; not a valid lambda expression

    (cl:let "a let expression" ((a 1)) (+ a 1))   ; the second element should be a list of bindings

    (cl:defun foo args (length args))             ; arguments needs to be a list

    (cl:let ((a nil t)) a)                        ; a binding is a variable or a list of symbol/value
and so on.

Lisp syntax is not the syntax of s-expressions. Lisp syntax is defined ON TOP of s-expressions.
> Still expressed as lists when it comes to the syntax level.
Comments are not expressed as lists. Feature expressions are not lists. etc etc...

coldtea1 reply#
>only a subset of s-expressions are valid Lisp programs.

Sure, but the thing we're debating is whether "all s-expressions are valid Lisp programs" (that would be a miracle actually), but whether Lisp syntax is all lists.
And all those examples are still lists -- that the lists can also contain other items inside them, or that underneath they are implemented as cons etc, doesn't really change that.
>Comments are not expressed as lists.
They are not retained anyway when the strings are parsed to the "live" AST (AFAIK), so they are an exception to the other syntax in that too.

lispm2 replies#
The page says:

> Most programming languages have several syntax rules. Lisp has one: everything is a list. The first element is a function name, and the rest are its arguments. Thus, the language is simply a collection of compile- and run-time functions, trivially extensible.
Step by step.
> Lisp has one syntax rule: everything is a list.
That's wrong. completely wrong. 'everything is a list' is not THE ONE syntax rule of Lisp. Lisp, like most other programming languages, has MANY syntax rules.
A defining feature of current Lisp dialects is even that the syntax rules are programmer extensible and thus Lisp has an unbounded number of syntax rules. Thus the complete opposite is true: Lisp has arbitrary many syntax rules.
> The first element is a function name, and the rest are its arguments.
That's also wrong. It always was. Lisp has since day zero supported more than just function call forms.
Valid Lisp expressions:

    3
    "1 2"
    ((lambda (a) a) 1) ; (lambda (a) a)  is not a function name
    (defun foo () ())  ; defun is not a function name
    (let ((a 1)) a)    ; let is not a function name
> Thus, the language is simply a collection of compile- and run-time functions, trivially extensible.

I would not even know what that actually might mean...

Continue this thread — 2 replies

PuercoPop#
> Still expressed as lists when it comes to the syntax level.

alists are not expressed as lists.