559 points · by DonHopkins · 6y ago · 217 comments
I like his poem in the article!
A little off topic, but I retired (that is a bit of a joke) and at the age of 69, this year I decided that for maximum programming enjoyment I would only use Lisp languages (linking in Python and TensorFlow on occasion). I am approaching 40 years using Common Lisp and using the language is so much fun. I bought a license for LispWorks and using it for developing a semantic web app.
https://nextjournal.com/kommen/gigasquids-libpython-clj-exam...
Also have you heard of Janet* ? what are your thoughts on such an approach ?
I had not heard of Janet, thanks for the link.
For resources, I would recommend Practical Common Lisp[0] and PAIP[1].
For some modern development practices, the Common Lisp Cookbook[2] is great.
[0]: http://www.gigamonkeys.com/book/
The idea that "functional language" means "purity" is something that was retconned onto functional programming in the 90s decades after Lisp had defined functional programming to mean programming in terms of expressions that produce values.
I like the ML/Miranda/Haskell lineage of languages a lot, but it really bugs me when people in that camp lay claim to some notion of being a "better" functional language than the older Lisp family. (Lispers, while smug about many other things, are generally less smug about how "pure" their languages' approach to functional programming is.)
This is like arguing that Lagavulin isn't "really" whiskey because real whiskeys are made in the US from corn mash.
In the beginning, "functional" meant functions were first-class objects and there was little--if any--global state. Lisp passes this test. Lisp invented this test (especially Scheme which introduced lexical scoping and closures).
If you want to write code with immutable data, you can certainly do so with Lisp; it just doesn't force you to. For the most part Lisp creates a brand new data structure when you "modify" an old one. You have to work a bit harder to actually mutate things.
Where e.g. Haskell is "more" functional than Lisp is more about automatic currying than immutability. Plus the static type system that allows monadic programming, which is much more difficult in Lisp because of Lisp's dynamic typing.
I guess I have even more to learn then :). Thank you for the links.
On Lisp is out of print, but can be downloaded.
They also have IDE like tools that are probably ready to go outside the box. Emacs with Slime isn't for everyone (I find it to be a big initial hurdle). Although I'm sure this guy is an Uber emacs expert.
Perhaps we can summon u/lispm for an answer here. I think he possibly works for LispWorks and is usually one of the lisp users on HN & Reddit that can answer questions pretty quick.
LispWorks is a relatively expensive commercial implementation of Common Lisp. There might be several reasons to buy it: cross platform GUI support (Windows, Linux/Unix, Mac), integrated IDE, various delivery options for applications, support for various hardware / operating systems, ... I personally also find the runtime system quite robust.
LispWorks has a very nice portable UI library. That was the selling point for me.
How do you like their IDE compared to emacs/slime?
Personally I prefer the CCL IDE but it only works on the Mac.
Would bet to be HolyC or "I might be wrong"
Ironically, Clojure doesn't use cons cells, although it does have a cons function.
Don't confuse CONS ARTISTS:
https://en.wikipedia.org/wiki/Category:Lisp_people
With CON ARTISTS:
cons n.v. 1. n. a compound data object having two components called the car and the cdr. 2. v. to create such an object. 3. v. Idiom. to create any object, or to allocate storage.
His book AI programming(Lisp version) is a gem that I enjoy reading. I've finish a book a few times already - but every time I read I find something new that I missed previous time.
https://news.ycombinator.com/item?id=9844026
That same Open Firmware Forth system [1], which was developed by Mitch Bradley [2], was not only in the PowerPC Mac bios, but it was originally used for the SparcStation boot roms, and eventually in the OLPC, and it was even an IEEE Standard 1275-1994!
[1] https://en.wikipedia.org/wiki/Open_Firmware
[2] https://en.wikipedia.org/wiki/Mitch_Bradley
In fact: the Open Firmware boot loader and plug-in card firmware interface technology, commonly used by both Sun and Apple, is the only firmware standard in existence to have its own theme song [3] !!!
[3] https://web.archive.org/web/20070204145613/http://playground...
: OpenFirmwareSong ( - )
\ By Mitch Bradley.
\ Sung to the tune of "The Flintstones".
𝄞
." Firmware" cr
." Open Firmware" cr
." It's the appropriate technology," cr
." Features" cr
." FCode booting" cr
." Hierarchical DevInfo tree." cr
." Hack Forth" cr
." Using Emacs on the keys," cr
." Save in" cr
." NVRAM if you please." cr
𝄒 cr
." With your" cr
." Open Firmware" cr
." You can fix the bugs in no time" cr
." Bring the kernel up in no time" cr
." We'll have an FCode time!" cr
𝄒 cr
\ Thank you and good night!
reboot
;Speaking of consing every pair, here's a previous discussion about "The Origin of CAR and CDR in Lisp (2005) (iwriteiam.nl)":
https://news.ycombinator.com/item?id=22910702
https://www.youtube.com/watch?v=mZyvIHYn2zk
https://s3-us-west-2.amazonaws.com/vulk-blog/ThePervertsGuid...
The main issue that arc solves is that it gives you a full pipeline for managing "objects with properties" via the web. It's so flexible. I wrote a thread on how we're using it in production to manage our TPUs: https://twitter.com/theshawwn/status/1247570883306119170
It's an interesting approach, as attempts to force statefulness on a stateless-by-design protocol go, but I don't know that I like how it scales.
You're right, it has some downfalls. But a lot of the time it simply doesn't matter. All the links at https://www.tensorfork.com/tpus are dynamic, and the speed you gain by being able to whip up a feature in 10 minutes is worth the pain of an occasional dead link.
On the other hand, I did some work for "deduplicating fnids": http://arclanguage.com/item?id=20996 which the site is using, so the links possibly last much longer than the early-HN links.
(Basically, we calculate the fnid key based on the lexical environment, rather than using a random ID each time the page is loaded. So each link gets a unique ID based on the code structure rather than a random ID. Meaning, instead of millions of random links to store, you end up with a few tens of thousands.)
https://en.wikipedia.org/wiki/Fnord
Or are they more like Vermicious Knids?
This is everything that is wrong with the software industry, summarized in one sentence. Speed gain enjoyed by developers is paid for by the users in pain.
It used to be that developers would go through tremendous amounts of pain just to squeeze out a few instructions from a UI drawing routine in order to make it just a little bit smoother for the users. Now those developers are derided as "greybeards."
I'm sorry, I probably could have found a less harsh and cynical way of writing all that, but I feel like the Internet is getting worse everyday and there's not enough urgency among tech people.
It's a shame arc didn't have persistent data structures (besides alists :-) and a native hashmap type though.
For those confused, we're talking about this: http://www.paulgraham.com/arc.html
You are in a CONS cell. The there is a CAR to the left, leading off to another CONS, and a CDR to the right, containing NIL. The garbage collector briefly enters the CONS, marks it, quickly glances at the NIL in the CDR, smiles quietly to itself, and looking relieved, hurriedly sweeps away through the CAR.
>GIVE CONS TO CDR
You give the CONS cell to its CDR, creating a circular list.
it handles all your sql and auth cookies? too bad now there's an easy way every script kiddie can now login as admin or guess cookies without the security header du jour.
It's all nice and all when it's being actively updated. But arc, rails, phoenix-ecto, node/react, drupal, spring, etc it all get old pretty soon when the core maintainers loose focus, and then instead of just keeping an eye on the latest best practices and implementing it yourself, you have to dive deep down into years of feature creep and bad coding practices to do the little thing you need to keep things going.
Apache Cocoon?
https://cocoon.apache.org/2.2/core-modules/core/2.2/1373_1_1...
racket's built-in web server does it too.
Including pg’s ViaWeb written in continuation-passing style: https://sep.yimg.com/ty/cdn/paulgraham/bbnexcerpts.txt
Truth be told, the criticism is a bit unfair (you can solve the problems)
Skip here comments regarding AI online courses, questions related to AIMA and PAIP books. It's not quite a good opportunity to inquire about finer points of JScheme or even ask clarifications along last September interview with Lex Fridman. The art of maintaining approachability for beginners and reference level of usefulness for advanced is not easy, but it's demonstrated - and here is flipped on another human side. Peter, thank you for your works for all of us.
> Think in hex, think in hex
> Look around you, who needs dec?
> You can do anything in base sixteen or I'll go to my rest!
https://www.senate.gov/artandhistory/history/minute/Have_you...
"Write in C": http://www.poppyfields.net/filks/00259.html
Someone apparently made a YouTube video too: https://www.youtube.com/watch?v=wJ81MZUlrDo
A wise man.
I mean I suppose some of the stuff I learned from his textbook was pretty useful too.
Shameless plugs in my post history. But to be clear, even a sheet of paper can be tremendously helpful.
His cover of NIИ's Hurt is so powerful. June Carter (his wife) died a few months after filming the video, and that just broke his heart. Johnny followed her less than six months later.
https://www.youtube.com/watch?v=8AHCfZTRGiI
Trent Reznor admitted that the song was no longer his after watching it.
https://columbophile.com/2018/03/11/episode-review-columbo-s...
https://www.youtube.com/watch?v=vtLYJ4STuXY
He was humping the pretty young girl singer, and murdered the mean old lady bible thumper in an airplane crash, then when Columbo finally (but barely) caught him, he was so remorseful he said he wanted to get caught all along.
this Johnny Cash song
Cash made it popular in the USA, but it was composed by Australian Geoff Mack.If a pair is consed in a forest, and no one observes it, did it really happen?
Some Common Lisp success stories: https://lisp-lang.org/success/
pgloader was rewritten from Python to CL: https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-fas...
Some companies still pick and use CL: Rigetti Computing (quantum computing), 3E (realtime aggregation and alerting engine of sustainable energy systems), OpusModus, an award-winning music composition software, ScoreCloud, an impressive speach-to-text music notation software, RavenPack (big data analytics provider for financial services), SISCOG (underground systems of many european capitals), Genworks (knowledge-based engineering),…
a community curated list: https://github.com/azzamsa/awesome-lisp-companies
I have also just deployed a website to a client last week: it reads an existing DB and shows products to the user. Simple, effective. I can hot-reload it if I want, it's built-in (I just use the REPL, I can even install new dependencies without a restart).
CL allows cool things like live-extending your browser: https://github.com/atlas-engineer/next
I use it for my startup. It's great for web dev. There are some really cool databases written with Clojure also.[2][3]
IIRC, our fearless leader PG made his zillions using Lisp.
> it's so easy to write a lisp system
Have you tried it, and how far did you get?
Making a Lisp system useful for production is pretty brutal.
13 years into it you will be debugging some eleven-year-old GC or compiler bug.
People think it's easy because they visualize the job as being done when some executable file converts (+ 1 1) into 2.
The Xerox Dandelion and friends was a thing to behold. If you ever got to touch one, you never forgot it.
In my school, implementing a basic Lisp interpreter was part of a required class in the CS curriculum. (If it's not still, everywhere, well, then for shame.)
Yeah, production is something else entirely. By "easy", I mean that dozens if not hundreds of people were tempted to write their own slightly better Lisp. Many of those did reach a production-ish level. But then what? There was no flag to rally around--just lots and lots of niche systems.
I'm not sure. I think if the community had rallied around Common Lisp or Scheme, or maybe just those two, it might have ruled the world. It just didn't happen.
And I'm miserably sad about that. What do we have now? Elisp is great, but I can't build production on emacs. I'll look at Clojure, but I'm dubious. Python is kind of lispy, but has had its own destructive schism. And C++ marches on--somewhere buried in there is a mildly functional lisp, using the worst of all possible syntaxes.
Hard disagree. The Clojure ecosystem is great.
Anyway, caches are only part of the problem with linked lists. The root problem is that they inhibit out of order execution. Work out the data dependencies and scheduling of a simple summation loop for an array compared to a linked list. Assume everything fits in L1. The out-of-order core goes to town with the array code and overlaps the fetches for subsequent iterations of the loop. But the linked list code is serialized with almost no instruction-level parallelism; you can overlap the summation of an element into the accumulator with the start of the deref of the next pointer, but that only saves you one cycle per iteration compared to what an in-order core would do with the same code. Now suppose the data is in L2. In that case the out-of-order core can overlap the loads of the subsequent array elements and the throughput is only diminished by a little if at all compared to the L1 case. The linked list code, on the other hand, works the same as before but because it cannot overlap the fetches for sequential elements due to the dependent loads, you go from say 5 cycles per iteration to 15 cycles per iteration. If you have to go out to L3 or DRAM the chasm dramatically widens even further.
More obviously, linked structures also increase pressure on cache capacity since they have to store their links explicitly. Yet another factor is that modern caches will expend bandwidth on speculative prefetches to reduce latency. This can help for both flat and linked data structures. For example, if you have an AST you should linearly allocate the nodes in the anticipated traversal order to get help from the prefetcher. (And please slim down those fat AST nodes.) If you did that for our linked-list summation example, you'd pay the 15 cycles for the first iteration but then you'd pay 5 cycles for the remaining entries in the same cacheline and also 5 cycles for all remaining entries in other cachelines since the prefetcher will have kicked in. So aside from the startup latency, you're back to running at the same speed as when the list started out in L1. But you're still losing out on the out-of-order execution for the L1 fetches: 4 cycles on a modern core is an opportunity cost of 16 instructions. You're reducing your core to a souped up 486.
By the way, for this particular toy example you should go beast mode with SIMD instructions for the array case which will net you another factor of 4x to 32x depending on the element size and the width of your vector unit and then you parallelize across your cores to get another factor of 4x. While those particulars might not generalize to less simple problems, it illustrates that the major issue with linked structures is that they force serial processing.
Cons lists were slow on the IBM 704 too. Good thing that didn't stop anyone, right?
> Are there any ideas how to adapt Lisp (or LISP) so that it plays well with current CPU architectures?
An ARRAY feature was described in the 1960 Lisp manual. That's probably because it was recognized that linked lists weren't the be-all data structure even on the IBM 704; sometimes it's nice to have compact storage and fast random access.
Can we move past this in 2020?
Let's leave this to the people who have a single aggregate structure in their programming language that is ambiguous between list and array.
The IBM 704 didn't have a cache hierarchy. The problem that the person you're replying to is talking about didn't exist on that architecture.
Accessing any memory location on an IBM 704 took the same time, so it doesn't matter if your values are consecutive in memory as in an array, or somewhere far away as possibly in a linked list.
But on a modern architecture reading a value far away can cause a cache miss.
What do you think the time penalty is for a full cache miss? Something small? Maybe a couple of times slower? No, the difference between a level 1 hit as often in an array, and a cache miss, as often in a linked list, is around two orders of magnitude.
It's literally multiple orders of magnitude worse relatively than it was on the 704.
Ideally modern Lisp implementations would use some kind of variant of the storage strategies pattern, as used for languages like JavaScript, to give the same semantics as a cons cell but actually using a cache-friendly implementation, but I think this is an unsolved research problem.
This is why I've long believed voting systems should restrict the voting age to 16-28. After all, whom would you rather have voting: people wracked with doubt and who fear their own ignorance, or people who know everything?
Great teachers recognise this and will give you a task that invites you to make the same errors as they did.
This is the basis of guild apprenticeships, PhD supervision, and 20% time for junior developers.
... and I’m happy to have listened and acted on that advice.
Not everyone will listen, but sometimes there’ll be someone that does, or having heard the same advice numerous times from different people it’ll start to sink in at least a little.
Why is that ironic?
Go back to school?
Sounds like someone mentioned how awesome a Lisp is. Ironically he said to someone who has done a bit of Lisp before. There ain't much to the OP story, or at least he hasn't divulged that much, but the song he wrote is pretty cool.
1) he knew he did LISP like languages and wanted to share 2) he didn't know he did LISP like languages and wanted to share 3) he was showing off. 4) the other choices.
I went to 3) based on my 40 years experience in computer science.
Imagine telling Dave Thomas about a cool language you found called Ruby, not realizing Dave has written a lot of Ruby.
Imagine telling Douglas Crockford about a cool language you found called JavaScript, not realizing Douglas has written a lot of JavaScript (much of it full of bad ideas, but that's irrelevant in this case).
Imagine telling Harold Abelson about a cool language you found called Scheme, not realizing Harold has written a lot of Scheme.
Imagine telling Randal Schwartz about a cool language you found called Perl, not realizing Randal has written a lot of Perl.
Like all of the above, for the respective language (LISP in Peter's case, C in Brian's, and so on), Peter Norvig is a well known master who has written a seminal work about the language.
q.v. Paradigms of AI Programming: Case Studies in Common Lisp
He also wrote Teach Yourself Programming In Ten Years, which many people who know basically nothing about LISPs have encountered and consider important.
If I would have any objection to the brief story's use of the term "ironic", it would be about the fact that many LISPers might not be as enthused about Clojure, so it's possible Peter hasn't really looked into it. Your question implied that Clojure is just "Lisp", though, and if we're talking about "Lisp" in a generic sense (i.e. the LISP family), I think Peter Norvig is one of those luminaries that everyone who pays attention to the social context and most important written works about LISP would know. I don't even pay that much attention to those aspects of LISP knowledge, and I know about him in the context of LISP.
That's not to say everyone who has an interest in LISP should be thought deficient for not knowing about Peter. It's fine if you haven't stumbled across him before. Sometimes, people just miss things that, in retrospect, might seem like something they should have known.
That doesn't mean you have to even have an interest in LISP.
This should, however, hopefully, give you a sense of why Peter might think it was "ironic", even if "ironic" feels a bit questionable as the appropriate choice of term there. I'm sure to him it felt a little ironic, and that makes sense to me as an emotional response, at least.
Does that help?
(Imagine telling William Shakespeare about the Renaissance era techniques of being a playwright, or telling James Cooke Brown about a conlang called Lojban. Of course, I suppose James might be dismissive of Lojban, given he tried to control Loglan by proprietary means after creating it, thus prompting others to reimplement it as Lojban, undermining his efforts at such control.)
edit: Note that I'm not saying there's anything wrong with someone not realizing one is speaking with a Big Name in LISP when meeting Peter Norvig. I'm just saying that Peter is perhaps justified in finding it a little "ironic", and jumping to conclusions about why he would feel that way (if that's what you're doing) might not be fair.
I would probably feel awkward in Peter's position. I've been in a similar position before, including once being told about a cool article that I actually wrote as if it would change my life, and I never know what to do in a case like that. How do you point it out without possibly making someone feel offended? Humans get offended at the silliest things sometimes, and I occasionally find it quite difficult to predict.
... (since, ya know, I rewrote a Lisp book to make it about Python, so if I said what I really think, there would be no end to the crow I'd have to eat), but anyway ...
https://news.ycombinator.com/item?id=1803815
>norvig on Oct 18, 2010 | parent | favorite | on: Ask PG: Lisp vs Python (2010)
>Peter Norvig here. I came to Python not because I thought it was a better/acceptable/pragmatic Lisp, but because it was better pseudocode. Several students claimed that they had a hard time mapping from the pseudocode in my AI textbook to the Lisp code that Russell and I had online. So I looked for the language that was most like our pseudocode, and found that Python was the best match. Then I had to teach myself enough Python to implement the examples from the textbook. I found that Python was very nice for certain types of small problems, and had the libraries I needed to integrate with lots of other stuff, at Google and elsewhere on the net.
>I think Lisp still has an edge for larger projects and for applications where the speed of the compiled code is important. But Python has the edge (with a large number of students) when the main goal is communication, not programming per se.
>In terms of programming-in-the-large, at Google and elsewhere, I think that language choice is not as important as all the other choices: if you have the right overall architecture, the right team of programmers, the right development process that allows for rapid development with continuous improvement, then many languages will work for you; if you don't have those things you're in trouble regardless of your language choice.
Kenny Tilton (smuglispweeny) tells this story, that ced posted a link to in the same discussion:
https://news.ycombinator.com/item?id=1803627
>ced on Oct 18, 2010 | parent | favorite | on: Ask PG: Lisp vs Python (2010)
>That reminds me of a cool story, in Norvig's talk about Python...
>When he finished Peter [Norvig] took questions and to my surprise called first on the rumpled old guy who had wandered in just before the talk began and eased himself into a chair just across the aisle from me and a few rows up.
>This guy had wild white hair and a scraggly white beard and looked hopelessly lost as if he had gotten separated from the tour group and wandered in mostly to rest his feet and just a little to see what we were all up to. My first thought was that he would be terribly disappointed by our bizarre topic and my second thought was that he would be about the right age, Stanford is just down the road, I think he is still at Stanford -- could it be?
>"Yes, John?" Peter said.
>I won't pretend to remember Lisp inventor John McCarthy's exact words which is odd because there were only about ten but he simply asked if Python could gracefully manipulate Python code as data.
>"No, John, it can't," said Peter and nothing more, graciously assenting to the professor's critique, and McCarthy said no more though Peter waited a moment to see if he would and in the silence a thousand words were said.
http://smuglispweeny.blogspot.com/2008/02/ooh-ooh-my-turn-wh...