Placeholder Image

Subtitles section Play video

  • So I talked about how lisp lets you grow the language in such a way and let you add syntax and so on.

  • And I want to unpack that a little bit and talk about this really fundamental concept, which is this duality between data code to traditionally separate things are actually more related than they kind of first appear.

  • What is Dayton code?

  • We don't need Thio Super formally talk about it there.

  • Concepts that are that are pretty well understood by most people.

  • Write everything.

  • That's data here with this red pen.

  • A few examples of data thieves could be numbers, for instance, like integers.

  • Almost every programming language has these almost every programming language rights on the same like 15 100 you could have symbols.

  • Not every programming language has this.

  • Some do recently was just such a the Julia programming language.

  • For instance, lisp as well has symbols.

  • That's basically anything that you can name.

  • So the variable X, the variables e maybe even something that's not just letters like the multiplication symbol, maybe the addition symbol, just a quantity that's named in some way.

  • These are very simple, sort of atomic piece of data and list.

  • They're called Adams.

  • There are composite piece of data like lists, lists go together in, for example, Python.

  • You write a list with square brackets, one comma, two comma three and list.

  • You write it with the parenthesis and just separated out with spaces.

  • Um, there's sin Texan in most languages for that.

  • Anyway, we could go through a bunch of different examples, but data are sort of knowns.

  • They're they're just pieces of their just objects that are that are sort of just there.

  • Code, on the other hand, describes usually some type of computation that you want to dio.

  • Usually these air more verb ian Nature.

  • So, for example, you want to do arithmetic or calculate an example of doing arithmetic is like computing one plus two times three.

  • This has a particular result.

  • This equals seven, and there's some evaluation process to it.

  • Another might be just displaying something.

  • For example, in C, we can print a string by using the print F function, but let's say we want to print the value of X and all these other things lots and lots of different code.

  • You can think of four loops, etcetera, etcetera is different for different ways of doing something of computing, something enlist.

  • There's a duality between these two things.

  • Both these things can be thought of at the same plane, and this is part of the reason why List gets its parentheses.

  • So in lisp, we write out a computation or a piece of data in actually the same way.

  • So maybe we want to look at this arithmetic here.

  • This enlist was written as plus one times 23 enlist.

  • Everything is written in prefix notation.

  • You always write the operator first, the verb that you're doing it in the operation's second.

  • So it's sort of similar to our p n, if you've heard of it, except it's reversed.

  • Reverse Polish notation.

  • The special thing about this is that we can interpret it in two ways.

  • It could be looked at his code.

  • It looks like we're doing one plus two times three, but it can also be looked at his data than list.

  • We write out a list using parentheses.

  • Here we write out symbols just as their names here and so enlist.

  • We actually have this explicit bridge.

  • We can look at it as data by using something in list called quote.

  • If we write enlist quote followed by this, then we get data.

  • We can also look at it is code.

  • We can write something called Evil followed by this, and it will be interpreted as code.

  • So really the same written representation of something.

  • The same parenthetical expression could be interpreted in both ways, and you can freely intermix both of these things in the same source file in the same source code.

  • So at any time you can sort of switch between the data representation, code representation, what does that give you?

  • That money.

  • That means you can then talk results of the computation and then made that part of the competition.

  • Yes.

  • Yeah, I think it's I think it's very powerful.

  • We can start thinking about building data, building expressions, using functions to manipulate data.

  • And once we've built it, we can turn it into code to evaluated.

  • So really, the power we get out of this is we can write programs that themselves right programs.

  • We can start automating the work of a programmer by having our programs right programs.

  • Once it becomes a tool in your tool belt, it becomes a very extraordinarily powerful thing that, like you yourself is a programmer can start programming.

  • The way in which you think about programming, If that makes sense, is they're really super simple example.

  • Yeah.

  • Yeah, definitely.

  • So one example is is back in the day before four loops existed.

  • For instance, the usual four loop Britain, and see is something like this.

  • Like, four.

  • I equals zero eyes, less than 10 I plus plus.

  • And then you, you know, do something.

  • What this will do is we'll repeat the body.

  • Whatever code we have here 10 times languages didn't always have a four loop in them.

  • Back in the day.

  • What you did was you wrote out assembly.

  • You'd set some address to zero.

  • I'm just going to say, said I to zero here.

  • Then the next thing you do is start executing your body.

  • Whatever you're doing here.

  • And then you say, Like, if I is less than 10 then jumped to start.

  • Otherwise I just continue.

  • And then you have a little label here called Start.

  • You can already see that There's a lot of busywork and even re unpacking.

  • Like what?

  • The definition of a four loop was back in assembly days.

  • But this is what you had to, right?

  • There is no way to write this in lists or any language that has met a programming.

  • You could imagine that if you have all these things that you can do in the language that we could just write a program that writes these out for us because we can write out data.

  • This is just data.

  • And then now we can re interpret this as code by using evil.

  • So enlist, you could have something like for eye from 0 to 10 and then some body of code right here.

  • And what we can have is this itself gets interpreted as a list of instructions like set I to zero a label here, start it's under etcetera.

  • I'm not gonna write it all out, But this idea that we can write programs that right programs weaken, build data and turn it into code so we can actually extend here.

  • This is a syntactic it extension.

  • It's a syntactic abstraction.

  • Now we take it for granted.

  • Of course.

  • I mean, four loops exist in every language, but you had to wait for the language designer to add the four loop for you.

  • There is no way to add it yourself.

  • Enlist, with this duality between data and code allows you to add these features yourself.

  • It's remote scripts.

  • U.

  • S.

  • O.

  • Post grip itself was incredibly interesting because now, instead of like being ableto prints on Lee, these very well defined things you actually now have a language for describing any sort of graphics that you want on the page with ultimate sort of freedom.

  • I would say it's sort of the same here that now you have this ultimate freedom to build the language as you see fit to solve the problems that you want.

  • Definitely an interesting connection.

  • I haven't thought about that before.

  • Thinking of a quantum computers like a GPU is is pretty fruitful.

  • GP use are aren't they our computers, in a sense, But really they're they're better thought of is like a co processor to your main computer.

So I talked about how lisp lets you grow the language in such a way and let you add syntax and so on.

Subtitles and vocabulary

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