News for hackers. Stuff that matters.
Re:The Idea of Lisp by QuadrupleA on Friday December 16, 2016 @12:40PM (#13195068)
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 of "pure forms" and grand ideas, but downplaying the important but messy practical reality of hardware, useful libraries, and getting cool stuff done with a minimum of fuss. I'm periodically fascinated by Lisp (I wrote an interpreter or two in C) but I wonder if its "Platonicity" is part of its downfall.
Re:The Idea of Lisp by mbrock on Friday December 16, 2016 @01:13PM (#13195345)
I don't think actual Lisp programmers share this obsession with purity and ideal forms. It's more something that shows up in blog posts about Lisp by people who probably don't actually use it. The title of this one is telling: it's about "the idea of Lisp."

On the other hand, if you look at, say, ANSI Common Lisp, it's not at all some kind of perfectionistic attempt at divine elegance. It's a pragmatic compromise resulting from years, decades, of actual use on real computers.

Just browse around the SBCL compiler source code and you'll see that this stuff is developed by people who definitely aren't afraid of the messy practical reality of hardware:

https://github.com/sbcl/sbcl/tree/master/src/compiler/x86-64

Generally spend some time within the Lisp community and see how many people you see fretting over Platonic archetypal shapes and compare to people solving actual problems and using the language as just a nice way to program a computer.

Emacs is another example that demonstrates the spirit of actual Lisp programming as opposed to armchair theorizing about lambda calculus fundamentals.

Re:The Idea of Lisp by QuadrupleA on Friday December 16, 2016 @02:33PM (#13196047)
That's good perspective. My lens on it has mostly been stuff like SICP, Paul Graham's old essays, periodic Lisp HN posts etc. Good to hear there's a community out there that's fine with the messy practical stuff.
Re:The Idea of Lisp by pjmlp on Friday December 16, 2016 @02:20PM (#13195930)
Specially since Lisp was once upon a time, also a systems programming language.
Re:The Idea of Lisp by pjlegato on Friday December 16, 2016 @05:29PM (#13197479)
ANSI Common Lisp is rather a design-by-committee monstrosity which was forced on the unwilling Lisp vendors by the Defense Department.

Most of the feature set was designed via backroom political horse trading ("We'll let you include pet feature X if you support us for our pet feature Y".) There is no coherent overall plan or design to it at all.

(Source: personal communication from a member of the committee that designed it.)

It's based on actual use on real computers of the late 1970s and early 1980s -- e.g. the file opening mechanism is a complex abstraction designed to support filesystem paradigms that nobody has used for 30 years, yet there is no standard way to open a TCP socket.

I heartily recommend Clojure (clojure.org) as an alternative: a modern, pragmatic Lisp designed for 2016-era software engineering.

Re:The Idea of Lisp by lispm on Saturday December 17, 2016 @02:02AM (#13199676)
Given that most of the hundreds of Lisp implementations each have their own way to open a TCP connection, Clojure just added another incompatible one. To claim that it is a standard one, is a bit funny. Each of the hundreds other implementations could claim that, too.

Clojure generally added incompatibilities, since it is fully incompatible to any other Lisp before in fundamental ways. Clojure was designed with zero backwards compatibility. Lisp concepts were removed, renamed, redesigned. Even identifiers with the same name are doing completely different things. If it did something similar to what Lisp did, Clojure sure has it renamed and redesigned.

I doubt that you ever had talked to anyone from the ANSI CL committee. It would also have been easy to find out that Common Lisp was designed by a few core people (the gang of five) with lots of community input from 1980 to 1984. This part is well documented. 1984 the first version of Steele's book Common Lisp the Language was published. The ANSI Common Lisp standardization was started later in 1986, when the core of Common Lisp was already defined. Even there the major extensions were designed by small groups with community input. See for example how CLOS was designed by a few people (Daniel G. Bobrow, Linda G. DeMichiel, Richard P. Gabriel, Sonya E. Keene, Gregor Kiczales, and David A. Moon.) and by providing a complete reference implementation (PCL).

Re:The Idea of Lisp by pjlegato on Friday December 30, 2016 @02:05PM (#13286422)
You missed the point. Clojure's way of opneing TCP connections is standardized within Clojure -- all Clojure programs use a standard API call to do that.

Common Lisp, on the other hand, has no standard way of opening a TCP socket at all, because TCP was uncommon when it was designed. It relies entirely on (poorly documented, often unmaintained) third party libraries to do that.

As for your doubts, you can doubt all you like, that changes nothing. I am well aware of the history of ANSI CL, and I'm not sure what point you are trying to make with all the namedropping.

Re:The Idea of Lisp by lispm on Friday December 30, 2016 @05:41PM (#13288137)
> all Clojure programs use a standard API call to do that.

Clojure says nothing about creating TCP sockets, since Clojure implementations (all three) need to call the hosting systems call or emulate it somehow. The JVM Clojure uses a different call than the CLR Clojure.

Which makes it worse than Common Lisp, which has widely used socket support with usocket and some others.

> Common Lisp, on the other hand

Is a real language standard with many different implementations.

> It relies entirely on (poorly documented, often unmaintained) third party libraries to do that.

Each Common Lisp implementation has a documented and maintained way to open a TCP socket. Additionally there are compatibility layers like usocket

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

> I am well aware of the history of ANSI CL,

Then why are you writing obviously wrong things?

Re:The Idea of Lisp by qwertyuiop924 on Friday December 16, 2016 @07:21PM (#13198155)
Clojure's an odd, unlispish language, at least for us Lispers and Schemers.

CL is still very good at what it does: all current implementations have solved many of the problems you mentioned, and there are a lot of libraries that will run across implementations.

CL is a beast, but clojure is a mess. Scheme is elegant, but has a radically different, more ALGOL mentality than CL, at least in some respects. Some of it is good, some is bad. I love it, but there are things that I would rather program in CL any day.

IMHO, clojure has neither the practicality of CL nor the elegance of Scheme. It has its advantages, but it's not ideal.

Re:The Idea of Lisp by anoctopus on Saturday December 17, 2016 @02:15AM (#13199716)
Could you explain what you think is wrong with Clojure? Maybe it's because I've spent far more time using it than CL, but I see Clojure as having a very consistent, well designed core. It's very opinionated in it's design, but it's a practical and pragmatic one. I don't see what's unlispish about it.
Re:The Idea of Lisp by ilurkedhere on Saturday December 17, 2016 @07:30PM (#13203615)
I use Common Lisp, and now sometimes Clojure. I don't get why folks call Clojure a modern-Lisp. I miss the cons cell abstraction, the multiple values support, condition system, the fast start-up times, the native compilation, and executables.

Stacktrace in Clojure with no possibility to restart also make me sad.

Re:The Idea of Lisp by pjlegato on Friday December 30, 2016 @02:07PM (#13286443)
All of these are rather minor secondary issues not related to the core Lispiness of the language (with the possible exception of cons, which is in any case still not terribly important in a practical sense as there are mostly equivalent alternative ways of organizing your code.)
Re:The Idea of Lisp by qwertyuiop924 on Sunday December 18, 2016 @06:32AM (#13205400)
Conditions are something I miss in Scheme. They sort-of-not-really exist in my Scheme of choice, and it makes me sad.
Re:The Idea of Lisp by qwertyuiop924 on Saturday December 17, 2016 @06:42AM (#13200306)
Well, there's the fact that lists aren't conses, and conses as Lispers would expect them to exist don't. I think conses are pretty useful.

But Clojure has the cons operator anyways. This also means that clojure's `read` violates one of read's important guarantees: the structure you read in will be identical to the structure you wrote out.

Then there's the macro system. Given, it's better than CL's in some respects (it does what you want by default), but there are problems. Like not being able to use macros inside the packages that they're defined it. It's just generally less clean than Scheme's solution, and less versatile than CL's.

And then there's all the things its inherited for Java: and object system that isn't properly OO, a lack of TCO (which would be fine, if it weren't for the fact that the language so very clearly wants to have TCO)

At the end of the day, Clojure's fine. It's not terrible or anything. I just disagree with some of its design decisions, just like with Racket.

But I do object to it being called The One True Lisp for practical use, because that's nonsense. Scheme and CL are both quite practical, and while most Schemes/CLs don't have the Java interop that makes Clojure so full of nice libraries, most of them do have a C FFI. And the C FFIs they have (at least in the Schemes I've seen) are some of the nicest around.

Re:The Idea of Lisp by anoctopus on Saturday December 17, 2016 @03:49PM (#13202488)
I agree that it isn't the One True Lisp, because there will never be one. Clojure is just a nice, modern lisp with some ideas I really like at the core of it's design.

I don't really care about having conses the way CL has them, and seqs feel like a very nice abstraction over the concept, though I also tend to use the idiomatic map-heavy style anyway.

Clojurescript has the staged macro issue, but JVM Clojure doesn't.

I wouldn't even say that Clojure has an object system, and wouldn't want one. Lacking TCO is a shame.

Re:The Idea of Lisp by kazinator on Saturday December 17, 2016 @11:16AM (#13201188)
All that immutability humbug, for starters. Traditional Lisps are "everything you can access is mutable".

Lisp trusts the programmer to be responsible with mutability and not to abuse it. The trust is not misplaced; the sky doesn't fall.

Re:The Idea of Lisp by anoctopus on Saturday December 17, 2016 @03:22PM (#13202315)
Immutability was what I had in mind calling it opinionated, and it's an opinion I agree with. After learning Clojure, I now hate working in languages with mutability. It obviously isn't necessary to make working applications, but I like not having to think about where else I'm passing this particular data structure, and the language has enough escape hatches for places when it really would get in the way.
Re:The Idea of Lisp by kazinator on Sunday December 18, 2016 @02:15PM (#13207092)
This is merely a psychological issue, because when you're programming in an "everything-mutable" Lisp dialect, you also don't worry about this. If you don't know where else you're passing that data structure and don't care to find out, then ... you don't mutate it. Libraries and API's simply don't mutate the inputs that you pass to them, unless loudly documented otherwise. Thus, mutation is applied in controlled ways whose scope is easy to ascertain and limit by inspection.
Re:The Idea of Lisp by qwertyuiop924 on Tuesday December 20, 2016 @06:25AM (#13218948)
...Especially in Scheme, where mutation is, by convention, loudly proclaimed! (not-quite-pun intended)
Re:The Idea of Lisp by lispm on Saturday December 17, 2016 @04:29AM (#13199993)
> yet there is no standard way to open a TCP socket.

The 'standard way' to create a TCP client socket in Clojure:

    (java.net.Socket. ^String host (int port))
For the .net version:

    (System.Net.Sockets.TcpClient. ^String host (int port))
It directly calls the functionality from the platform it is hosted on.
Re:The Idea of Lisp by pjlegato on Friday December 30, 2016 @02:10PM (#13286488)
Yes. That's the point. The one standard way to open a TCP socket is with java.net.Socket.

Common Lisp, on the other hand, has no such standard way, as TCP was not common when it was designed. It relies on a hodgepodge of poorly documented third party libraries, or vendor-specific extensions to do this.

Clojure is, by definition, a JVM hosted language. The .net version is non-canonical.

Re:The Idea of Lisp by lispm on Friday December 30, 2016 @05:56PM (#13288247)
^> The one standard way to open a TCP socket is with java.net.Socket.

So Clojure the language has no documented standard way to open a socket. One has to use the host environment (JVM, .net, ...) interface to do so. It means also that Clojure/JVM source code trying to open a socket will not run on Clojure/CLR without changes.

That's not a 'standard'. It's the definition of 'implementation specific'.

That's different from SBCL, which has a documented and maintained way to create sockets, which works similar over all the platforms it runs on - natively.

http://www.sbcl.org/manual/#Networking

For a portable way to create sockets over many Common Lisp implementations use usocket:

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

Re:The Idea of Lisp by bluefox on Friday December 16, 2016 @06:45PM (#13197945)
Why do you have to resort to such bullshit in order to promote your favorite language. Please back up your claims.
Re:The Idea of Lisp by cesarbs on Friday December 16, 2016 @06:24PM (#13197826)
What about ISLISP? Granted, there are much fewer implementations compared to CL.
Re:The Idea of Lisp by goatlover on Friday December 16, 2016 @01:47PM (#13195633)
But then again, there's Scheme ...
Re:The Idea of Lisp by cicero on Friday December 16, 2016 @03:09PM (#13196318)
Even Schemes can take a practical turn, e.g. Racket.
Re:The Idea of Lisp by qwertyuiop924 on Friday December 16, 2016 @07:24PM (#13198168)
Racket isn't Scheme. It is its own dialect. That's why it's no longer called Scheme.

At present, there are only a few Schemes that are practical: Chicken, Guile, Chez, and Gambit seem to be the big players, with Cyclone, Chibi, and Bigloo bringing up the rear.

Re:The Idea of Lisp by dTal on Saturday December 17, 2016 @01:30PM (#13201751)
Wow, pedantic much? It started out as a pure Scheme, then "took a practical turn" as the parent said. You can still make it act like a pure Scheme with a #lang directive.

It's also kind of funny that a handful of major, practical implementations is considered a low amount. Number of Python implementations? Between one and three, depending on definition. Number of Javas? 2 or 3 again. Number of Clojure implementations? One. Javascript? Half a dozen at most.

Seems to me like the problem is standardization between these implementations, not overall number.

Re:The Idea of Lisp by qwertyuiop924 on Saturday December 17, 2016 @01:55PM (#13201864)
>pedantic much?

Not at all.

>It started out as a pure Scheme, then "took a practical turn" as the parent said.

False.

PLT Scheme, like all serious schemes, started out as Scheme extended for practical use.

Racket, what PLT Scheme became, isn't an extended Scheme: it is a different language with its own semantics. That's not good, bad, or pedantic, but it is true.

>You can still make it act like a pure Scheme with a #lang directive.

No, you can make it use RnRS. The difference is that in actual Schemes, the language you write in is extended RnRS, not an entirely different language.

At the end of the day, calling Racket a Scheme is like calling Java a C: they look similar, but they are radically different under the surface.

Re:The Idea of Lisp by samth on Sunday December 18, 2016 @01:12PM (#13206825)
I think the truth is somewhere between what you and dTal said. First, Racket isn't much more different from "Scheme" now than when we changed the name in 2010. Second, if you copy-and-paste a random portable Scheme program into #lang racket, it will probably work. This is somewhat less likely than with most systems that call themselves Scheme, but way more likely than with Scheme's closest relatives (Arc, Clojure, etc), and similarly with Java vs C.

Ultimately, Scheme is a language family, and Racket is further away than most or all of the other members, but there's considerable distance between Guile and Gambit as well (to pick some other examples).

Full disclosure: I'm a core developer of Racket, but not all of us have the same perspective on this question.

Re:The Idea of Lisp by grzm on Saturday December 17, 2016 @01:34PM (#13201776)
Number of Clojure implementations? One.

At least three:

- Clojure on the JVM: https://github.com/clojure/clojure

- ClojureScript (JavaScript): https://github.com/clojure/clojurescript

- Clojure on the CLR: https://github.com/clojure/clojure-clr

Re:The Idea of Lisp by dTal on Saturday December 17, 2016 @03:28PM (#13202356)
I stand corrected. That was the only one I didn't check out. I didn't know about Clojure on the CLR but in fairness I should have remembered Clojurescript.
Re:The Idea of Lisp by omaranto on Friday December 16, 2016 @06:53PM (#13197992)
Or Chicken.
Re:The Idea of Lisp by chubot on Friday December 16, 2016 @01:36PM (#13195542)
Yes, I really like Taleb's books because they are about the gap between theory and practice -- and in particular, how to make bets and take action to discover that gap.

His later books go into this too: how academics rewrite history in favor of the ideas they created, but "tinkerers" create history.

I believe he uses the example of the Wright brothers. Were they physicists? No, they were engineers and tinkerers. And what is amazing is that people still argue about the physics of how planes fly!!! Practice often precedes theory.

Whether there's a similar phenomenon in computing is an interesting question. Computing is sort of special because the finished product, a program, is probably the closest thing to a pure idea that you will find in engineering (as opposed to a plane or a telescope). It is created almost entirely in the human mind.

On the one hand, you could say that what you learn in school is idealized and gives academics too much credit. To use a recent example, what was the contribution of Phil Katz vs. academic research in compression? That would make for an interesting essay I would love to read.

What about BitTorrent, or BitCoin? I believe plenty of academics were trying to create systems like BitTorrent, and publishing papers about them, but Bram Cohen said he pulled a bunch of magic numbers out of his butt and dealt with router quirks, and made it work. But certainly he also used computer science.

I like this essay, "Notes on postmodern programming": https://scholar.google.com/scholar?cluster=16064138633971247...

Some excerpts:

The word “algorithm” is often claimed as the central concept of computer science [35] “Algorithm”, however, leaves out large amounts of the discipline of programming: components, patterns, protocols, languages, data structures [76].

There is equal acceptance of high and low culture: Visual Basic and Haskell are equally of interest, as there is no reason to applaud the one and disparage the other

Postmodern programming rejects overarching grand narratives. As a result, it favours descriptive reasoning rather than prescriptive. Rather than working top down from a theory towards practice, postmodern programming theories are built up, following practice.

Re:The Idea of Lisp by icheishvili on Friday December 16, 2016 @05:14PM (#13197379)
This is the challenge I have as well. I want to use Lisp for a lot of things but the reality is that parsing PDFs, tagging parts of speech, and then throwing it all into Postgres/Elasticsearch is a lot easier with a bunch of "gem install" commands than anything I've seen for Common Lisp.
Re:The Idea of Lisp by white-flame on Friday December 16, 2016 @10:14PM (#13198979)
(ql:quickload "packagename") works great in Common Lisp.

The QuickLisp package manager has been around for a few years now.

Re:The Idea of Lisp by icheishvili on Saturday December 17, 2016 @03:38AM (#13199893)
QL is a package manager. I'm talking ecosystem/libraries. Use QL to install postmodern and tell me how you feel about its time zone support.
Re:The Idea of Lisp by qwertyuiop924 on Saturday December 17, 2016 @06:57AM (#13200361)
If you want to see a Lisp desiged for practicality (other than CL, which definitely was, make no mistake), Kaz Kylheku (who goes by kazinator around here)'s TXR is a neat thing. It's a combination of Lisp and a pattern matching language, desiged for data-munging tasks similar to those done by AWK and Perl. But it's actually better than AWK (I won't go so far as to say it's better than Perl: it is, however, more regular than Perl, which is a nice thing), because the pattern matching language was designed with multiline records in mind, and is a lot more readable than a long regex, IMHO. And the built-in lisp was deliberately optimized for succinctness, something many lisps don't do well. You can find some examples at http://www.nongnu.org/txr/.

And if that's not practical, I don't know what is.

Re:The Idea of Lisp by pjlegato on Friday December 16, 2016 @05:25PM (#13197451)
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".

Re:The Idea of Lisp by kazinator on Friday December 16, 2016 @08:47PM (#13198618)
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.