Live data from Hacker News

The Idea of Lisp

dev.to

271–280 of 348 posts

Re: The Idea of Lisp

#271

Earlier quoted context omitted.

The difference between an empty tuple (also known as unit) and void becomes obvious when you deal with vaguely complex trait impls. For example, if you have a trait: trait Foo { type ErrorType; fn bar() -> Result ; } How would you specify that your type implements Foo in such a way that bar() cannot return an error? If you were to implement it using the empty tuple (unit), like this, it could actually return an error…

I don't think anyone is claiming Void in Scala/Haskell/Rust is equivalent to Unit in Scala/Haskell/Rust. The question here was Unit vs empty tuple. Up-thread was the question of whether C "void" is more like S/H/R Unit or S/H/R Void.

Upthread was:

> If Rust follows Scala then `()` is not the empty tuple, but rather Unit (void in C*).

The implication is that () == Unit == void. The empty tuple and unit are essentially equivalent aside from name, void is something else.

Re: The Idea of Lisp

#272

Earlier quoted context omitted.

I don't think anyone is claiming Void in Scala/Haskell/Rust is equivalent to Unit in Scala/Haskell/Rust. The question here was Unit vs empty tuple. Up-thread was the question of whether C "void" is more like S/H/R Unit or S/H/R Void.

Upthread was: > If Rust follows Scala then `()` is not the empty tuple, but rather Unit (void in C*). The implication is that () == Unit == void. The empty tuple and unit are essentially equivalent aside from name, void is something else.

Regardless of who is right, you are arguing the wrong bit of it. I contend that, to a person, everyone saying "C void is Unit" doesn't think C void is Void. Arguing that Void is not Unit is just completely spurious. Of course Void is not Unit. No one disagrees.

In truth, C void is not exactly either Void or Unit. Like Void, you can't exactly make one... but you can call functions declared to take it and write functions that return it, and really it just means "I have no information to pass" - which is more like Unit.

Re: The Idea of Lisp

#273

It's interesting, I'm reading Black Swan at the moment by Nassim Taleb, and one of his big rants is about how we get blinded by idealized, platonic forms and ideas when the real world is messy and inherently unpredictable. E.g. trying to explain the forms of nature with platonic archetypal shapes like circles, rectangles and triangles. Lisp and the community around it kinda has that flavor - getting lost in a world o…

Quite right. That's why Clojure was invented. Clojure is a modern Lisp with the explicit goal of being a practical and pragmatic Lisp intended for getting real-world software engineering tasks done, not just a grand walled garden with beautiful and pure ideas but without standard libraries for stuff like, say, "opening a TCP socket".

CL has no ISO standard library for opening a TCP socket.

Clojure has no ISO standard library for opening a TCP socket.

I don't see the difference.

Usocket: Common Lisp socket library:

https://common-lisp.net/project/usocket/#implementations

Walled garden? I can make a native executable for Windows using any one of several Lisp implementations. No framework or VM or whatever required.

Clojure saves some people from programming the JVM in Java; good for them.

Re: The Idea of Lisp

#274
post #70

This article has many misstatements in its first half. > John McCarthy wrote 6 easy things in machine code, then combined them to make a programming language. John McCarthy didn't implement Lisp in machine code. Steve Russell did. Implementing Lisp properly in machine code is not easy; you have to write a garbage collector. To do that in the early 60s, you had to first invent garbage collection . Lisp was and is bril…

How many primitives does it take to build a LISP machine? Is it ten, seven or five? (And how many did McCarthy use?)

http://stackoverflow.com/questions/3482389/how-many-primitiv...

Re: The Idea of Lisp

#275
post #232
post #70

This article has many misstatements in its first half. > John McCarthy wrote 6 easy things in machine code, then combined them to make a programming language. John McCarthy didn't implement Lisp in machine code. Steve Russell did. Implementing Lisp properly in machine code is not easy; you have to write a garbage collector. To do that in the early 60s, you had to first invent garbage collection . Lisp was and is bril…

> John McCarthy didn't implement Lisp in machine code. McCarthy also didn't expect S-expressions to be a concrete form. He expected everybody would write in M-expressions. The fact that S-expressions worked as the language itself is again due to Steve Russell's insight.

The problem was that M-expressions are just really silly way of spelling S-expressions, almost node for node, atom for atom. Whatever disadvantages we agree S-expressions have, M-expressions have all of them, and then some: like extra noise due to punctuation.

What are M-expressions? Basically this:

   (a b c)                          (quote (a b c))
   car[x]                           (car x)
   car[append[(a b c); (d e f)]]    (car (append (quote (a b c)) (quote (d e f))))
Parentheses implicitly quote. Square brackets are non-quoting, but the first element goes outside. Inside square brackets, pointlessly superfluous semicolons appear.

S-expressions developed the ' notation for quoting, almost eliminating the slight advantage of M-expressions there:

   (a b c)                          '(a b c)
   car[x]                           (car x)
   car[append[(a b c); (d e f)]]    (car (append '(a b c) '(d e f))))
The apostrophe notation is smarter; I don't see a way in M-exps to quote an individual atom. Though M-exps give us this:

   (x)                              (quote (x))
if we want (quote x) it looks as if we have to write:

   quote[x]                         'x
whose lameness is self-evident.

I think MacCarthy was exploiting M-expressions for the way that most trivial instances of them look different from S-expressions, which was a useful distinction to have in the papers about Lisp. With an M-exp you could whack the reader over the head and say "hey reader, this is character syntax: what you enter into the machine" and then with S-exps you say "this is a textual picture of internal structure".

There are other ways for that though, like different fonts, or upper/lower case and whatnot, or some REPL convention where we show the prompt in front of what is typed in, plus the "result arrow" and such.

Re: The Idea of Lisp

#276

Earlier quoted context omitted.

Expressions are limited, because they can only return one result. In stack based languages like Forth and PostScript, any function can take and return any number of parameters. In fact they can decide at runtime how many to take and return. PostScript is a lot like Lisp in that it's purely and simply homoiconic: PostScript code is just normal PostScript data. The "ifelse" operator takes a boolean and two expressions…

PS seems like a nice language. Such a shame it's stuck on the printer: it seems like it would be a good alternative to FORTH in less memory-constrained environments.

NeWS is a Network extensible Window System developed by James Gosling at Sun in the 80's, which used PostScript not just to draw on the screen (like NeXT), but also (unlike NeXT but like AJAX) to implement entire window managers, user interface toolkits, applications, and intelligent responsive front-ends to networked applications, all in the NeWS window server (like a web browser).

NeWS was architecturally similar to what is now called AJAX, except that NeWS coherently:

+ used PostScript code instead of JavaScript for programming.

+ used PostScript graphics instead of DHTML and CSS for rendering.

+ used PostScript data instead of XML and JSON for data representation.

http://www.donhopkins.com/drupal/node/97

See the PSIBER and PizzaTool code I posted in the message above for an example of what was possible with NeWS!

Re: The Idea of Lisp

#277
post #241
post #239

Earlier quoted context omitted.

That is the account that I had read before. It only talks about Steve Russell's first implementation and makes it sound like a mechanical transform into reality of a theoretical implementation. However Wikipedia says that there is a second, and the person that I was responding to indicated that Steve Russell had to create a garbage collector to make it work. Those are things that I had not previously heard, and I'm c…

I have no reason to believe that Russell wrote a garbage collector for the first Lisp implementations. I used the adverb "properly" specifically because it's possible to implement Lisp without GC, but this isn't really a viable approach long-term. So to make Lisp practical, significant work on GC had to be (and was) done.

My understanding is that the first version of Lisp with true GC was Scheme. Which was, not coincidentally, the first version of Lisp with lexical scope and closures.

The first implementation of Lisp used reference counting.

Re: The Idea of Lisp

#278
post #70

This article has many misstatements in its first half. > John McCarthy wrote 6 easy things in machine code, then combined them to make a programming language. John McCarthy didn't implement Lisp in machine code. Steve Russell did. Implementing Lisp properly in machine code is not easy; you have to write a garbage collector. To do that in the early 60s, you had to first invent garbage collection . Lisp was and is bril…

Moreover, a Universal Turing Machine is not described in itself. The classic one (read-write head with infinite tape) is certainly not described using a read-write head with infinite tape; it's described in plain language plus math notation.

If you write a JS interpreter in JS, a heck of a lot of work is in fact done for you.

That's why every teenager and his dog has a transpiler from something (resembling JS or not) to JavaScript.

Re: The Idea of Lisp

#279
post #184
post #70

This article has many misstatements in its first half. > John McCarthy wrote 6 easy things in machine code, then combined them to make a programming language. John McCarthy didn't implement Lisp in machine code. Steve Russell did. Implementing Lisp properly in machine code is not easy; you have to write a garbage collector. To do that in the early 60s, you had to first invent garbage collection . Lisp was and is bril…

> Implementing Lisp properly in machine code is not easy; you have to write a garbage collector. That's not actually true: you could, instead, just fill up memory and crash when you're out. It's not ideal, but it does work.

That might not meet some expectations behind the word "properly".

Re: The Idea of Lisp

#280
post #25
post #2

The conditional expression or more specifically everything being an expression is my favorite thing about Lisp. I did not know that McCarthy pushed to add it to Algol which apparently today is the ternary operator for most languages. It is annoying that so many languages (C, Java, C#, etc) have both a conditional statement (if-else) and conditional expression (ternary ?:). Really the if-else should be an expression (…

If you like everything being an expression, check out tcl. A lot of ideas from lisp show up in tcl, especially the idea of everything as an expression. Tcl embodies this idea while also having the look of an algol-like language. Funny it can pull this off while having basically no syntax.

Your profile says "Ask me about Tcl".

How?

Post reply on HN