Placeholder Image

Subtitles section Play video

  • 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...

Lisp is a language that was invented back in the 1950s.

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it