239 points · by Tomte · 3y ago · 136 comments
Some would argue Brendan Eich of Netscape accidentalled a scheme in JavaScript, but others would argue that he didn't. Most accidental schemes are pretty bad, and the original JavaScript fits the bill, or it doesn't, depending on what you think to be a scheme.
There's a law about that: https://en.wikipedia.org/wiki/Greenspun's_tenth_rule
It comes up in most DSLs.
I bet this is a better accidental scheme, by virtue of the author, but a big part of the point of a scheme is that it's easy to implement, yet powerful. MIT freshman used to build a scheme interpreter and a scheme compiler in their first computer science course (6.001).
It's very easy to accidentally a scheme.
I googled and found someone’s blog post with a fun description: “JS is stupid Lisp in Java’s ill-fitting clothing. It’s Alonzo Church going to a Halloween party as Alan Turing. It’s the lambda calculus in Turing-machine drag. It’s a quirky nerd with a cynical marketing department. (The syntax and the name of the language — JavaScript—were determined by Netscape’s desire to ride the coattails of Java’s popularity in the early 1990s.) It’s multiparadigm salad.” https://medium.com/thinking-with-computers/javascript-is-not...
For the story from Allen Wirfs-Brock and Brendan Eich.
Section 2.1, starting on page 7, talks about the portion of JS history where Eich was hired to build a Scheme in a browser and continues with why it changed and how.
I don't say this to claim he was right (I didn't agree with him, at the time), but merely to point out that "what is not a Scheme is actually" NOT "pretty well defined in terms of language concepts and features."
A proper Scheme is as defined in Revised Report on the Algorithmic Language Scheme, but there are many improper half-baked Schemes too.
Reasonable people can and do disagree about which things do and don't qualify.
1: https://groups.google.com/g/comp.lang.lisp/c/Bj8Hx6mZEYI/m/6... (besides the inevitable flamewar started by @lisper's question, there's actually some good discussion between the "adults in the room" well downthread of what I linked).
A scheme is for life, not just for Christmas.
Do you mean s-expressions here (sexps), or is there also a thing called s-types that I've been missing?
* I meant s-types.
* There is no such thing. The problem, as Clinton: "It depends on what the meaning of the word 'is' is."
S-types WERE a thing, but never a major one.
I ran across them as a high school student on a random research project at a university as a summer internship of some kind. They were used by a handful of research groups for some data interchange format. Literally the only person who would find the interesting is myself, and not for what they were, but because they were my first exposure to Lisp / Scheme concepts, which I had not heard of before, and which triggered a series of (high school grade) epiphanies for me (which would probably be obvious to 50+% of the people here).
As far as I know, S-types no longer exist. A quick web search brought up zero references. There is absolutely no reason to know about them in 2023. However, if you want to know about them:
- They were quite literally S-expressions. All S-types were S-expressions
- However, they were well-specified, so useful as an import/export format
- In particular, they had research-grade libraries to do the above from at least two languages (I would guess Java and LISP, but I no longer recall; perhaps it was C++ and Scheme).
- There was some attempt to simplify, but I no longer recall what it was. I recall that I was told it had something to do with lists versus function calls, but looking back on it, the explanation I recall being told makes zero sense. That's more likely a function of my memory than the explanation.
I believe on that internship, my direct use of them was probably limited to looking at some data in that format. This was really at the outskirts of the project I was doing. They did inspire a lot of work during the school year, when I schemed for the first time, not really knowing what I was doing but figuring out a lot of stuff in the process.
Looking back at it, though, having a standardized Python / JavaScript / etc. import/export library for some standardized version of S-expressions might be helpful. Or it might not be. Who knows.
That was my first thought too. As the length of your codebase increases, the likelihood of (probably badly) accidentally a scheme'ing tends towards 1.
I want to frame this sentence and hang it on my wall.
If you're serious about learning a Lisp but motivated more by, as you say, "having more fun" rather than, say, landing a six-figure job writing it professionally... then may I recommend Janet[0] for your consideration. Janet is an embeddably-small, yet surprisingly batteries-included Lisp implemented in pure C. In terms of syntax and core library it borrows more directly from Clojure than from Scheme, but all the modern Lisps have their bits of influence. I've found both the language and the tiny little community that exists around it delightful.
As an example of the latter, somebody smart wrote a real actual book[1] about Janet recently that was on the HN front page for a day or so when he first released it. It's a gentle introduction not just to Janet but to Lisp in general, and assumes only general proficiency with JavaScript to get you up to speed. I recommend it.
Because it's not built around linked lists, the core type most encountered for lists of data is arrays and tuples. Neither is conducive to efficiently removing elements mid-set, or composing two sets, or interleaving two sets, or other operations that require reordering, replacing, adding or removing elements in the set. When I'm writing code in lisp I don't think about that overhead much, because for linked lists it's not an issue.
Janet's REPL has a debug mode, but I'm sadly not qualified to evaluate whether/how it measures up to CL's due to my own inexperience with either. :)
As for restarts (I had to Google around to get an idea of what that means)—it seems to me that Janet does not have first-class support for restarts in the way that some other Lisps, for e.g. CL, do. Presumably (as it would be in most other languages I would suppose) one could recreate that experience in Janet by tapping into the first-party error handling and REPL primitives. But you'd definitely be rolling your own rather than having it already in Janet out of the box.
What Lisp should we learn if we want to make money from it?
That said, I don't think it matters much. A developer familiar with some lispy language (and perhaps functional programming) should be able to quickly pickup any other lispy language. And the developers that make the most money have probably used a lot of programming languages, with different paradigms.
[0]: https://survey.stackoverflow.co/2022/#top-paying-technologie...
[1]: https://survey.stackoverflow.co/2023/#section-top-paying-tec...
I got my first job furiously doing that for nights on end. It felt like cheating but it’s ultimately way faster than waiting potentially years to figure out those tricks on your own.
> The goal of the Make-A-Lisp project is to make it easy to write your own Lisp interpreter without sacrificing those many "Aha!" moments that come from ascending the McCarthy mountain. When you reach the peak of this particular mountain, you will have an interpreter for the mal Lisp language that is powerful enough to be self-hosting, meaning it will be able to run a mal interpreter written in mal itself.
~ https://github.com/kanaka/mal/blob/master/process/guide.md
Interacting only with something you have made is the worst possible way to learn anything about existing, mainstream Lisp.
Not knowing anything about the prior art will practically ensure that your own thing is a collection of quirks specific to it, and that then ensures that your Lisp knowledge is entirely rooted in and limited to that thing.
You're just not going to single-handedly reinvent things that took numerous hackers over several generations to figure out. You may be "good", but so were they, and there is only one of you.
You will not even be able to converse with actual Lisp people, due to not having the right concepts and terms.
I feel MAL does a decent job illustrating the core concepts of Lisp, but then I'm not a Lisp expert by any means.
It's since become a meme of sort as a more general way to flag as a joke that you've done something "accidentally" where a fully formed sentence would be more ambiguous.
E.g. "I accidentally created a scheme" might still not be entirely serious about it being an accident, but it's open to interpretation and sets a slightly more serious tone. "I accidentally a scheme" clearly signposts the title is at least in part a joke.
Not if you're unfamiliar with the joke. And with the lack of capitalization, the bad grammar had me figuring this was an ESL author.
I seem to recall it from high school, and that was before mobiles were widespread.
Does he regularly a scheme? Or did he do it in the past? Both!
In particular, the first sentence is similarly playful with its choice of words; suffice to say this is intentionally poetry
Up until the end of the sentence, the reader doesn't know whether a verb is going to occur. English usually arranges a sentence with subject-verb-object ordering ("I ate my meal."), and not subject-object-verb ordering ("I my meal ate."), so this is unlikely. However, variations occur, such as "Neither a borrower nor a lender be." in Macbeth, or "Frankincense to offer have I" from We Three Kings. These tend to be somewhat archaic usage, and so an author may deliberately use this tone for a sense of formality.
This is similar to a garden-path sentence [0], where the sentence cannot be easily parsed in order. Up until the title ends, we don't know if the title will so formal that it changes up the word ordering (e.g. "I accidentally a scheme brought forth.") or so informal that it omitted a word without realizing it. This contrast between extreme formality and extreme informality becomes a source of humor when resolved.
(And by dissecting a joke, I have made it that much funnier. I'm great at parties.)
Happy retirement to him!
For example here's a self-contained Python program to make various types of linked lists and traverse them, making sure the GC can follow the resulting pointers in C++, with field inheritance, vtable pointers, etc.
https://github.com/oilshell/oil/blob/master/mycpp/examples/c...
Stealing that expression.
The title is from a meme. Like before the memes of today, when a meme was an image around a black frame with white text.
It usually goes "I accidentally a <thing>".
But I found joy very early in this essay. "Tonight's missive is an apology: not quite in the sense of expiation, though not quite not that, either; rather, apology in the sense of explanation, of exegesis: apologia."
When an introduction provides such a concise but entertaining junglegym for the reader, surely the rest will be enlightening. And if not, we have short attention spans, so we click elsewhere :).
Rosanna, Rosanna, to Parton the Lamb!
https://web.archive.org/web/20190327161227/http://www.lolcat...
I knew I was not in favor of GCs. For any reason. A pox upon the landscape of software.