How to loop in a loopless language (Y Combinator)

  Рет қаралды 18,533

A Byte of Code

A Byte of Code

Күн бұрын

Пікірлер: 83
@crabbyboi9127
@crabbyboi9127 2 жыл бұрын
I'm just going to pretend i was smart enough to understand that.
@AByteofCode
@AByteofCode 2 жыл бұрын
first lol
@raglandasir6885
@raglandasir6885 2 жыл бұрын
me too
@omkarbhale442
@omkarbhale442 3 ай бұрын
Us us
@syed--2023
@syed--2023 Жыл бұрын
He teaches so fast that you can't even get spare time to process it.
@ivandrofly
@ivandrofly Жыл бұрын
Pause
@adumont
@adumont Ай бұрын
Yes it's very useless to teach... Sorry to say. Pausing and getting back every tenth of a sec and trying to get half a tenth of a sec... Is simply impossible. What is the "..." in your factorial lambda expression?
@monstereugene
@monstereugene 2 жыл бұрын
im happy to report understanding half of that
@crabbyboi9127
@crabbyboi9127 2 жыл бұрын
lol
@electronpie
@electronpie 2 жыл бұрын
Damn! A half? You must be a genius then, I could only understand about a third of the thing!
@AByteofCode
@AByteofCode 2 жыл бұрын
Ey not bad :)
@themathguy3149
@themathguy3149 Жыл бұрын
I liked the content very much, but as a bit of suggestion , it would be easier for me to understand if there would be more examples, there went a moment in the video that the ideas started piling up and the screen got too cluthered for me to get it. But anyway amazing content, expressed in a very didact manner.
@AByteofCode
@AByteofCode Жыл бұрын
Very interesting feedback, I'll absolutely keep that in mind!
@zyansheep
@zyansheep 2 жыл бұрын
Kinda weird how you need different combinators for recursion depending on whether you do strict or lazy eval...
@AByteofCode
@AByteofCode 2 жыл бұрын
I do agree, and there are even more recursion combinators depending on how you wanna do it. For the Z combinator, you could swap out the f(x(x)) terms with f(\v.x(x)(v)) to avoid needing to do rec()(x-1)
@ultrio325
@ultrio325 2 жыл бұрын
YOU HAVE NO IDEA HOW LONG I'VE WAITED FOR THIS VIDEO
@ultrio325
@ultrio325 2 жыл бұрын
I've been trying to use numbers and booleans to try to make a conditional so that one could pass a "condition" function to check if the loop should be exited PROBLEM is I have ZERO idea how to do equality, and I can't do subtraction either
@AByteofCode
@AByteofCode 2 жыл бұрын
I mainly have fun trying to figure out stuff on my own but I'll try my best to help with some theoreticals. My main idea for predecessor (aka -1) would be to have a tuple (0, false) and then iterate on it with your numeral. If the second part of the tuple is false than just return (0, true) otherwise increment the 0 part. This would return your numeral minus 1. Then just apply that a few times to substract. I've yet to figure out equality though, so good luck with that and let me know if you find anything :)
@MeanSoybean
@MeanSoybean 2 жыл бұрын
I feel like I barely understand it but not enough to remember how to construct since the video really is going way too fast for me. And I usually put x1.5 or x2 on most comsci videos and this one I didn't.
@AByteofCode
@AByteofCode 2 жыл бұрын
Sounds pretty normal. If you have any questions do be sure to ask. (Also this should be the last hyper complex video for a long time, as I've run out of math stuff to cover lol)
@SimGunther
@SimGunther Жыл бұрын
@@AByteofCode With research papers, you'll never run out of math topics! 😈
@AByteofCode
@AByteofCode Жыл бұрын
@@SimGunther Of course there's more math stuff to cover! Just the channel is about computer science so I wanna focus back on the programming stuff
@grivza
@grivza Жыл бұрын
Not just for you, I've studied a bit about lambda calculus and combinators and already knew about all that stuff but it was still too fast. In order to understand, you literally need to pause after every sentence and try the stuff out yourself.
@superboy9431
@superboy9431 2 жыл бұрын
is it ok if I ask questions about what I didn't understand?
@AByteofCode
@AByteofCode 2 жыл бұрын
Don't ask to ask! Go ahead!
@SolomonUcko
@SolomonUcko 2 жыл бұрын
1:11 What if it were to call itself using fact(fact)(x-1)?
@AByteofCode
@AByteofCode 2 жыл бұрын
Something like that would be a way to do it. When I was researching this video someone I talked to was hell bent on that being the only way to do it well. Simply its not the Y combinator so it didn't exactly fit the title lol
@ai_serf
@ai_serf 25 күн бұрын
we should also be able to apply a type/procedure that references itself for it's definition. in haskell: loop = loop main = loop
@Oi-mj6dv
@Oi-mj6dv 11 ай бұрын
Dude i fn love your channel. Its like fireship but better. Here you are talking about APL, looping using combinators and some crazy shit. Mega fan keep it up. Btw this is why when dealing with recursion its nice if a language supports TCO. AHEM SCHEME AHEM. That way you dont have to polute your functions
@AByteofCode
@AByteofCode 11 ай бұрын
Thanks so much for the kind words! + I totally agree that TCO is the goat
@magne6049
@magne6049 2 жыл бұрын
The notation makes the video confusing. It would be better to slowly introduce only the strictly necessary notation.
@AByteofCode
@AByteofCode 2 жыл бұрын
I mean there's only one piece of notation, and most of the logic was covered in the previous video. I do agree though, everything gets so long I don't bother animating it and so quality suffers :\
@magne6049
@magne6049 2 жыл бұрын
@@AByteofCode Thanks for replying. I didn't see the previous video, just came across this one. So I might have lost some context. Btw, for animation, try Keynote Magic Move which will automatically make smooth animations that are particularly good at these kinds of things (transforming/iterating on equations). Then it's easier to introduce every little piece in a more stepwise fashion. Best of luck forward!
@koalabear2
@koalabear2 2 жыл бұрын
This video is very confusing.
@AByteofCode
@AByteofCode 2 жыл бұрын
At least I'm self aware xD What part did you not understand so I can clarify?
@koalabear2
@koalabear2 2 жыл бұрын
@@AByteofCode mostly everything. But that's my fault. It's great as an intro to lambda calculus
@changwanpark7164
@changwanpark7164 2 жыл бұрын
Thanks for the quality content :D. One question, at 1:22, how did you come up with the idea that passing to it self? I mean, it works, but how does the derivation work?
@AByteofCode
@AByteofCode 2 жыл бұрын
No problem! The idea of passing it to itself wasn't originally mine so I can't answer that. Otherwise what do you mean about derivation?
@changwanpark7164
@changwanpark7164 2 жыл бұрын
@@AByteofCode Oh I was just asking about how did you get that key idea of passing to itself. Anyway thanks for responding!
@garklein8089
@garklein8089 2 жыл бұрын
we know that we need to recurse somehow. how are we going to recurse? by calling a function; a bound variable the only way to bind variables is with parameters, so now we know we need to call a parameter to recurse what should this parameter contain? it's logical for it to contain the whole function hope this made sense
@changwanpark7164
@changwanpark7164 2 жыл бұрын
@@garklein8089 yes makes sense! Super thanks
@AmitSingh-ty5hw
@AmitSingh-ty5hw Жыл бұрын
one day I'll be smart enough to understand all of that
@AByteofCode
@AByteofCode Жыл бұрын
Its less about intelligence and more about learning Also some day I'll be better at making topics more easily understandable :)
@Truttle1
@Truttle1 2 жыл бұрын
0:52 I am going to like this video, so I will like this video, to do that I will like this video, but in order to do that I will have to like this video, but first I need to like this video, but first I need to like this video, but first I need to…
@AByteofCode
@AByteofCode 2 жыл бұрын
Sounds about right :) The question is would this increase like count or decrease it?
@NorbiPeti
@NorbiPeti 2 жыл бұрын
@@AByteofCode It would increase the like count by a half. :) There was a debate about something similar in one of the groups I'm in lol and someone pointed to Grandi's series.
@AByteofCode
@AByteofCode 2 жыл бұрын
@@NorbiPeti I'd be interested in knowing a bit more about what that debate was on, if you don't mind?
@NorbiPeti
@NorbiPeti 2 жыл бұрын
@@AByteofCode Oh, actually, it was more abstract than this one. 0 = 1 - 1 + 1 - 1 + 1 ... being solved to be 0 = 1 using parentheses.
@AByteofCode
@AByteofCode 2 жыл бұрын
@@NorbiPeti oh i see
@Rhys_1000
@Rhys_1000 Ай бұрын
how to add memory in lambda calculus
@UJ-nt5oo
@UJ-nt5oo Ай бұрын
You somehow made the situation worse with this video
@MACAYCZ
@MACAYCZ Жыл бұрын
I really love your videos!
@AByteofCode
@AByteofCode Жыл бұрын
I am very glad to hear that!
@LibreGlider
@LibreGlider 3 ай бұрын
I just wanted to learn more about monads so I could write better Rust code. 45 min later I've subbed and am on my way to watching the entire video catalogue.
@AByteofCode
@AByteofCode 2 ай бұрын
Awesome, thank you!
@PunmasterSTP
@PunmasterSTP 2 жыл бұрын
I...have to take some time to wrap my brain around this.
@AByteofCode
@AByteofCode 2 жыл бұрын
Fair enough, the video wasn't as good as it could've been
@PunmasterSTP
@PunmasterSTP 2 жыл бұрын
@@AByteofCode Oh no, I think your video was really good. It's just the subject matter in general, and my lack of familiarity with it, that will require me to do some grappling...
@aaravbhatt760
@aaravbhatt760 2 жыл бұрын
Why don't programming languages such as python and js use lazy evaluation then?
@AByteofCode
@AByteofCode 2 жыл бұрын
There are pros and cons for each. (I'm gonna add this to my video ideas list) It's mainly a matter of predictability and purity. Firstly, strict evaluation means you know exactly when something will be calculated, but lazy evaluation overall performs a little bit better. The second (and most important) reason is that in lambda calculus or haskell, there are (in theory) no side effects, global variables or anything else. That means it doesn't matter when something is calculated. On the other hand, say in python you see "print('hello world')", do you completely ignore it because its return value isn't being used anywhere else? No, because its an instruction meant to do something. Since JS/PY/etc don't have baked-in concepts of purity and side effects, any function call (or even operation as they can be overwritten) could be doing something special and you don't want to miss out on that!
@liudvikassablauskas1950
@liudvikassablauskas1950 11 ай бұрын
This video is only for those already know everything in this video and even then it's tough to keep up
@AByteofCode
@AByteofCode 11 ай бұрын
I agree this video was absolutely not my best work. Your criticism is 100% correct
@xxedgelord420xx4
@xxedgelord420xx4 2 жыл бұрын
It's the VC company that makes Hacker News.
@AByteofCode
@AByteofCode 2 жыл бұрын
Technically the truth
@chezmemo
@chezmemo Жыл бұрын
Beautiful!
@vikingthedude
@vikingthedude Жыл бұрын
You broke me bro
@AgnaktoreX
@AgnaktoreX 6 ай бұрын
Thank you so much for this short explanation. I get the picture, now I need to dive deep
@AByteofCode
@AByteofCode 6 ай бұрын
Good luck!
@funmath3835
@funmath3835 Жыл бұрын
i broke my mind.
@AByteofCode
@AByteofCode Жыл бұрын
Sounds about right
@mickolesmana5899
@mickolesmana5899 11 ай бұрын
😅
@sanjaux
@sanjaux 11 ай бұрын
Now this is programming
@mr.duckie._.
@mr.duckie._. 7 ай бұрын
when X combinator
@AByteofCode
@AByteofCode 7 ай бұрын
It does exist, but its not as interesting. The X combinator (in simplified terms) applies an argument to itself. In practice you don't really use it.
@LambdaJack
@LambdaJack 2 жыл бұрын
Let's see if you redeem yourself by making a better presentation.
@AByteofCode
@AByteofCode 2 жыл бұрын
Honestly I agree, this video wasn't very good. I bit off a lot more than I could chew. I'm gonna downscale complexity of future videos by a lot so that people can actually understand the stuff
@TheThinKing
@TheThinKing Жыл бұрын
the last chapter of the Little Schemer is the one chapter that tripped me up so thank
@AByteofCode
@AByteofCode Жыл бұрын
Glad it helped ;)
@nothingtoospecial777
@nothingtoospecial777 2 жыл бұрын
Where can I learn more about this?
@AByteofCode
@AByteofCode 2 жыл бұрын
I'd recommend joining TheSTEMGamer's discord server (look up his channel its linked there) and asking the people there. They're the ones who taught me what I needed to know to make this video so I'm pretty sure they'll be helpful to you!
@nothingtoospecial777
@nothingtoospecial777 2 жыл бұрын
@@AByteofCode Thanks.
A brief introduction to APL (A Programming Language)
2:44
A Byte of Code
Рет қаралды 32 М.
The most intriguing discovery of Computer Science: the Y combinator demystified.
13:07
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 2,5 МЛН
Офицер, я всё объясню
01:00
История одного вокалиста
Рет қаралды 4,9 МЛН
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 137 МЛН
Spongebob ate Patrick 😱 #meme #spongebob #gmod
00:15
Mr. LoLo
Рет қаралды 19 МЛН
What is Lambda Calculus? (ft. Church Encodings)
15:11
Alex Lugo
Рет қаралды 52 М.
Compiled Python is FAST
12:57
Doug Mercer
Рет қаралды 111 М.
Lambda (λ) Calculus Primer
34:26
LigerLearn
Рет қаралды 10 М.
Essentials: Functional Programming's Y Combinator - Computerphile
13:26
Programming with Math | The Lambda Calculus
21:48
Eyesomorphic
Рет қаралды 197 М.
Learn Lambda Calculus: The language with ONLY FUNCTIONS
12:48
Lambda Calculus!
9:51
Truttle1
Рет қаралды 54 М.
Is Computer Science still worth it?
20:08
NeetCodeIO
Рет қаралды 354 М.
Exploring Word Chains
9:45
CodeParade
Рет қаралды 217 М.
Wireless switch part 177
0:58
DailyTech
Рет қаралды 2,2 МЛН
3x 2x 1x 0.5x 0.3x... #iphone
0:10
Aksel Alze
Рет қаралды 2,7 МЛН
Смартфоны через 10 лет
0:12
История одного вокалиста
Рет қаралды 236 М.