Lisp, The Quantum Programmer’s Choice – Computerphile

Lisp, The Quantum Programmer’s Choice – Computerphile

Lisp is a language that was invented back in the 1950s. It is capable of doing functional programming, but it’s actually often misattributed as being a functional programming language. In general, it’s a so-called metaprogramming language, or a symbolic programming language. It can be used for any sort of task that you might want do. It’s a general-purpose language, Lisp. It’s been said that learning Lisp just helps you be a better programmer in general. It opens up a lot of different ways of thinking that are sort of locked away in languages like Java or C++ or what have you. It has a few interesting ideas, such as this idea of homoiconicity, where the language itself is written as a data structure that you can represent in that language.. This idea of metaprogramming, where not only are you programming in the language to solve a problem, but you can program the language itself. You can change the structure of the language itself to make it more suitable for a particular application. And even if it was just for learning those concepts, you’d become a better programmer in other languages. Nonetheless, it still remains a language… Common Lisp, in particular remains a language that’s very, very good at solving modern real-world problems. I actually would draw an analogy to physics a little bit. Like, good ideas, ideas that are fundamentally good are usually ones that stand the test of time. Now, computer science and computer programming is not a very old art, so to speak. It’s, you know, less than a century old. However, there are lots of theories in physics, for instance, that were sensible, they allowed you to make predictions. For example, the sun going around the Earth. It seems reasonable. You see it. But there’s a kernel of an idea later that the Earth goes around the sun. And that is a physical theory that, one, turned out to be true, but also stands the test of time. There are good ideas in it that are fundamentally good. And so I think that just the fact that Lisp started in the 1950s and still has something, still has some kernel of an idea that’s good, I think makes it worth learning, even if it’s not used day to day. (off) You do use it day to day, don’t you?
(Smith) Yes. So, Lisp, even still, going back to this kernel of an idea, is good at building a language that I want. I can’t think of anything that’s better than using a programming language that allows me to build the language that I need to express my problem. The stuff that I work on day to day is quantum computing, where there isn’t a lot of literature on how to wrangle the problems that come up in quantum computing. Quantum computing uses quantum mechanics, which is a very, very different mathematical language than just addition of numbers, for instance. It is a very strange world, where things have all different types of rules. So, modern programming languages don’t support expressing these constructs in a very fluid way. Often, I need to sort of build my own sort of language in order to express solutions to problems that I’m having. Now, you can do this in a language like C++ or Java. You can build your own parser, you can build your own compiler, you can build all of the things you need just to be able to write solutions to problems. But in Lisp, it allows you to grow the language ever so slightly in a very easy way, so that in Lisp directly I can express these new constructs. And it’s very helpful for these types of new domains. We’re actually extending the syntax of the language. So, one example that I like to bring up is, back in the days of programming Assembly, if you wanted to do something like a “for” loop, you wrote down this structure where you’d have this explicit “jump” statement, and then you’d have a separate counter somewhere, and it’s all just a bunch of lines of Assembly. Nowhere in the Assembly code are you actually saying, like, “for i from 1 to 10”, or something like that, but you know the concept is there. You know as the programmer what you mean by these instructions is a “for” loop. What Lisp does is allow you to take that idea of a “for” loop and actually syntactically be able to write a “for” loop. So it’s not just a library of functions. It’s actually new syntax and new functionality in the language. (off) But it all does come down to Assembly in the end, doesn’t it?
(Smith) Yes, absolutely. Yeah, it all gets compiled to Assembly in the end. (off) So this is a way of organizing your thoughts as a programmer.
(Smith) Correct, yes. That’s, I think, ultimately what it’s optimizing for, allowing you the programmer to organize your thoughts. Most of the time in programming is spent thinking, so that’s the progress that I want to optimize in programming. Not necessarily the efficiency of the program, although you can do that, and other things. It’s being able to even get the solution to the problem out on paper or on the screen in the first place. (off) And would you say you’re faster doing it this way? (off) There might be somebody out there going, “Yeah, I could do that in Haskell, I could do that in C.” (Smith) So, instead of taking my word for it, we did this little program where I work where we had college students, interns, come in and try the language, then try to use it for solving some of these quantum problems. And the first reaction is, like, “Whoa, there are lots of parentheses.” If you look at Lisp code, there are lots of parentheses. And then it’s… Well, the documentation is sometimes a little bit shaky in certain places. But once they kind of got through that first bit of the learning curve, the feedback that I got is that they could think about their problems in a more fundamental, or more structural fashion, that the language itself wasn’t getting in the way of solving their problems. It’s that now they could express what they think in a more direct fashion, without so much of an impedance mismatch. Fortunately, Lisp was originally defined in, like, half a page of code. Like, the entire language. And in that page of code, they had very few concepts that bring to light all of these things that I’m discussing. Namely, the notion of S expressions, which is how the Lisp language itself is built, how you write it. And following that, this notion of macros and metaprogramming, how we can extend the language. And I think these two things really bring to light how all this stuff works. The special thing about this is that we can interpret it in two ways. It can be looked at as code. It looks like we’re doing 1+2*3. But it can also be looked at as data. Remember that in Lisp we write out a list using parentheses, here. We write out symbols just as their names here. So in Lisp, actually have this explicit bridge…

100 thoughts to “Lisp, The Quantum Programmer’s Choice – Computerphile”

  1. Like with many Computerphile videos, I just can't appreciate why this topic is important without concrete examples. Glad to see another video is on the way.

  2. Your videos are great but they would be better if the lessons are animated instead of people just talking .with respect to all❤

  3. Is it just me or does Computerphile's endslates never actually have clickable links? :< I want to watch that meta-programming video but it's not clickable. (And yes I'm aware the links are usually in the description, but it's more intuitive to click the annotations.)

  4. Cakewalk Application Language scripting was based on this. The weirdest concept for me was that the plus, minus, increment, equals and other operators are written first. But surprisingly it started to make sense soon.

  5. So isn’t binary the irrefutably best (most universal) “language”? It allows you to do, in theory, everything you want. Generate an infinite string of 1’s and 0’s and somewhere in that string is every program ever written. As a matter of fact, some subset of that infinite string perfectly describes the entirety of our physical universe. Mind=blown?

  6. I was waiting for him to write some code on his paper and then the video ended. I didn't learn anything…

  7. A Colonel of an idea. Not quite as advanced in rank as a General idea, but still a solid idea nonetheless.

  8. You needed to have had Richard Stallman doing this video; then again, I supposed you wanted it to be less than 2 hours in length, so…

    … OR… someone with a lithp…

  9. I can't put my finger on it, but this guy rubs me the wrong way. I think it's because he's the embodiment of reddit. An 'expert' throwing out buzzwords that doesn't know how to explain his topic. Strangely I respect teachers more after watching this video.

  10. Do you ever wonder what the very last YouTube comment will be?
    I'm gonna bet it will be written by a robot.

  11. I+n reviewing main frame programming of the oldest supercomputers with the future of quantum language/code in deepMind,
    within 20 years U & Eye shAll have found severAl hyperGlyphic weighs for moding hyperGraphics to encode and scale quantum stubs for today/tomorrow's quantum enTangled Internet(s of Things)/Neuronet(ting of All Things & People & Places & App(liance)s & Vehicles & Holograms involving inter-federal approved & licensed Neuronet AI or Neuronet architecture.

  12. I can't click on the “meta-programming” video at the end. There's no link and does not appear in the general search.

    What happened to it?

  13. A decade since my loops looked like for(int i=….). Now I am counting cores and dividing into shared/private variables.

    I have never seen a quantum computing problem though.

  14. So by inventing the fitting langue on the way doesn't that result in noone being able to comprehend the done work in a reasonable time?

  15. I expect something more of an edutainment channel in youtube than having simply a guy sitting in a chair and talking without any graphic support or any examples. This is lazy video production.

  16. How can you use x86 architecture for quantum computing? It seems x86 would need some ASIC/FPGA to provide an interface between that and the wires going to quantum computer.

  17. Webmaster, the two floating popups to related articles are covering up the two static links to related articles. The latter are inaccessible. Both in Chrome and Safari.

  18. loved this intro, would be great to have some more concrete examples of how he uses it in quantum computing

  19. I enjoyed the video but you don’t show an example of the code, not even something simple, would be better if you showed us how some of the concepts he was exposing actually appear

  20. I noticed there was no discussion of having someone else understand his code. When he extends the language, does he publish an API? Is the code itself documented? Maybe it won't matter…
    Maybe it will.

  21. I remember xkcd's author's a fan of Lisp…didn't think much of it when he mentioned it in his comics, but now i'm intrigued.

  22. why not use Mathematica for example? I use it to "program" the theory rules or formalism, so i can do physics computations automatically

  23. …quantum computing is where they simulate a neutron decaying in less than 700 seconds half-life if you can wait long enough for the full answer… (p.s. 700 was updated to 880±)

  24. I’m glad I decided to try lisp out. It’s a great programming language. I don’t know why I like it so much though but to me it feels really intuitive, even after only 2 days of messing with it. With python, that took me a month. After 4 years of Python being in all 5 of my top 5 list of favorite programming language, lisp has crawled it’s way up there to 5th place. Places 1-4 are still Python though…

  25. 1:45 Show a flat earther this clip, see if they can make something of it. 😂
    “Saying this is not to scale is a conspiracy!! It’s flat!…… They’re all flat!!” 🤣

  26. I used to sit at a lunch table with this guy in high school. You guessed it. We were not the cool kids.

  27. The end of the channel's videos cut off mid-sentence. Is there another site where we see the entire video? Thanks.

  28. I see Converse-Polish Notation, transverse operational listing,
    wright next to Reverse-Polish Notation.
    (At the same time..) Non-linear code/language write nExt to Linear language/code.
    A Quantum Server for storing hyperGraphically compiled Holograms in Mass(ive) Data,
    ¹n² quantum inFormation; available for reCalling over and over aGain.

  29. Just bought 'Structure and Interpretation of Computer Programs' by Abelson and Harold. I used to know BASIC when I was a little kid and I am just getting back into computer science. I think my best bet is to start off fresh with Lisp. Lectures from Abelson and Harold are available through MIT OpenCourseware.

  30. LISP almost vanished in the 1970's: even with outsourcing to China, the entire world was incapable of producing a sufficient supply of parentheses. Advanced automation — the production of parentheses in pairs — enabled it to hang on for a while, but it was always a struggle.
    Quantum computing is its only hope: propositions which simultaneously are and are not in parentheses!

  31. "…can change the structure of the language itself to make it more suitable for a particular application…". This is actually how I think of Object Oriented Programming!!!

  32. ; ; well then
    (((((it makes sense) that the "gnu" project) prefers this language) so much
    (due to their philosophy of "modularity"))

  33. Geez comments-people, chill out! The video is titled "programmers choice" with a programmer explaining WHY it's his choice … that's it! It's conversational. Listen to what he's saying and then go find videos focusing on the code if you want to know more.

Leave a Reply

Your email address will not be published. Required fields are marked *