Code vs Data (Metaprogramming) - Computerphile

preview_player
Показать описание
Why are code and data so separate? Robert Smith of Rigetti Quantum Computing explains how he uses Lisp code to generate Lisp data which he can use as Lisp code...

This video was filmed and edited by Sean Riley.

Рекомендации по теме
Комментарии
Автор

Linear algebra has this same kind of duality between data and function. A matrix is just a collection of data in most cases but when you multiply a matrix by some other matrix or a vector the matrix acts as a transform or a "function/code" on the data that passes through it. A change of basis is a transform matrix that acts as a function while at the same time could be further transformed by rotations and scaling matrices and act again as just data.

ninjalacoon
Автор

@2:52: *Reversed reverse Polish Notation* or as sane people would call it... polish notation ;-)

zzfkbcu
Автор

Dude, please start a programmer's channel with a LOT more code. These videos are a tease.

alanvitullo
Автор

@5:20 - I've been there, too. Writing the loop in assembly and forgetting to INC the counter. Those days the only cure was rebooting your pc.

Passiday
Автор

"So could you give us an example?"

"Oh sure, definitely. So lets say you wanted to draw an owl. First you just draw some circles. Right? Then you draw the rest of the owl, which I wont do here because its obvious."

tsunaminoai
Автор

I don't know, all this meta & functional programming seem so powerful because you can allegedly write compact code.
The problem I see is the same as with Perl: Can a third party actually decipher that code, or do we have to add 10 lines of comments for every line of code?

benjaminfacouchere
Автор

I love listening to this guy talk, I don't know why

sweetspotendurance
Автор

Really nice broad pass over metaprogramming 👍

jaymalby
Автор

This duality between data and code is much more common than most people think. One very simple example: most of us view a .c file as code. But to the compiler, it's data.

ArumesYT
Автор

I want more from Robert Smith. This guy is good.

-notakil
Автор

Great video! I enjoyed the explanations and written examples. Thanks Mr. Robert Smith. 😊

SilverPsycheMetal
Автор

Am I correct to say that Lisp as he describes it is better off for math problems while C is better off for dealing with memory... cause that makes scenes why you would rather use Lisp over C for something like Quantum problems as stated in last video

KnownNever
Автор

To me that for-loop example seems very similar to defining a function that takes other functions as its arguments, though perhaps with a nicer syntax. Would love some more in-depth examples.

emilemil
Автор

I remember back in the early 1980s, when programmable calculators starting blurring the lines between computers and calculators, I read a quote (which I'm sorry I don't recall the author of) which said that the difference between calculators and computers is that the latter can operate on their own programs as if they were data and vice-versa, whereas the former cannot.

gejyspa
Автор

"reverse RPN" is not Reverse Reverse PN, it is just PN. Polish notation is like + 1 2 or add 1 and 2, RPN is 1 2 +. Polish notation was specifically prefix notation, which was considered more natural than 1+2 because you can write +1 * 2 3 to mean 1+(2*3), and indeed, this is a common notation used in compiler intermediate codes. However, RPN is considered even more natural than this because 2 3* 1+ exactly expresses operands and the operators that use them in proper order. Thus get 2, get 3, multiply, then get 1, and then add to the result of 2*3. It also is stack machine friendly.

If there never were such a thing as polish notation, I'd agree that reverse RPN makes sense, but polish notation was a thing before RPN.

scottfranco
Автор

Forth is another wonderful language that still stands the test of time. This vid mentions Postscript, which is very much a variant of Forth.

vicplichota
Автор

Would be interesting to see a clarification of how this topic compares to compilers in general -- because, of course, compilers are programs that write programs. I was waiting for the comparison and distinction to be made in this video, but it never happened.

brianbarefootburns
Автор

Fun fact: ".. prefix notation is similar to postfix notation such as RPN." Beginning with the HP 48 calculator instead of using RPN the manual refers to RPL which is not defined. A search on the web gives the unofficial acronym of "Reverse Polish LISP" which it is. If i enter "{1 2 3 * +}" and press ENTER that program is placed on the stack. Pressing EVAL then evaluates the expression leaving "7" on the stack. Notice how the parens dissapear in RPN/RPL. There is no PROGRAM/RUN mode switch on this machine; everything is eval mode and is placed on the stack!

NoirpoolSea
Автор

I'd love to see someone debug a metaprogram that contains thousands of lines of business logic :)

Majorohminus
Автор

I'm getting all warm and fuzzy when I see the _LISP_ syntax. Brings back good memories from when I used it with AutoCAD.

ZeedijkMike