Why functions are turing complete (Lambda Calculus)

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ม.ค. 2025

ความคิดเห็น • 228

  • @pointthink
    @pointthink 2 ปีที่แล้ว +517

    Ow my brain

    • @aydynx
      @aydynx 2 ปีที่แล้ว +7

      really simple to understand if you have some background on cpu architecture and logic gates

    • @w花b
      @w花b 2 ปีที่แล้ว +2

      facts

    • @CMDRunematti
      @CMDRunematti 2 ปีที่แล้ว +18

      @@aydynx im not even sure if this was programming, math, or what... and how did i get here...

    • @user-pr6ed3ri2k
      @user-pr6ed3ri2k 2 ปีที่แล้ว +2

      on

    • @natsudragneelthefiredragon
      @natsudragneelthefiredragon 2 ปีที่แล้ว +1

      @@user-pr6ed3ri2k off?

  • @Truttle1
    @Truttle1 2 ปีที่แล้ว +123

    You can write the halting problem proof in lambda calculus by showing that a function that determines if another function will ever reach a fully reduced form leads to a contradiction.

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +18

      :o truttle! Also yeah, seems to make sense. I love how simple so many things are in lambda calculus lol

    • @Tabu11211
      @Tabu11211 2 ปีที่แล้ว +3

      @YT that needs to be a yt series

    • @orangenostril
      @orangenostril 2 ปีที่แล้ว +1

      @@Tabu11211 a YT series

  • @orterves
    @orterves 2 ปีที่แล้ว +115

    Thus solving the hardest problem in software engineering - naming things.

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      How so?

    • @AshesOfEther
      @AshesOfEther 2 ปีที่แล้ว +24

      @@AByteofCode It's a saying that the hardest problem in computer science is naming things, because it can be really hard. If you can't assign stuff, there's nothing to name

    • @orterves
      @orterves 2 ปีที่แล้ว +33

      ​​​@@AByteofCode just a tongue in cheek joke. Have you heard, "There are only two hard problems in computer science - cache invalidation, naming things, and off by one errors"

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +6

      @@AshesOfEther ooh i see lol, nice one

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +3

      @@orterves yep, one of my favorite cs jokes

  • @AByteofCode
    @AByteofCode  2 ปีที่แล้ว +12

    Sorry for the long wait, I was in Norway. As usual, what did you and what did you not enjoy in the video, please be honest with me so I can make better content for you guys!

    • @aaravbhatt760
      @aaravbhatt760 2 ปีที่แล้ว

      Ok, so this is a great video once u understand it - I learned how data types can be represented as functions, but I needed to try stuff out on a whiteboard to understand it. Maybe add examples on why something works or doesn't. (I was wrong before, here in my question)

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      ​@@aaravbhatt760 the half assed assignment you can do is very limiting with scope, and so in your example there f x would not be able to reference a, so it wouldn't work. remember its less assignment as just humans naming patterns so we can simplify using the system

    • @aaravbhatt760
      @aaravbhatt760 2 ปีที่แล้ว

      @@AByteofCode I think I just understood it now, makes sense. I've been learning Haskell, and was confused why u can do that in Haskell. But then, does that mean Haskell isn't fully based on lambda calculus as we can name functions?

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      @UC4Qih8jTMfBcmVxV98RnNnw Haskell is a lot more complex than lambda calculus, which is the BARE minimum you need to work. In lambda calculus, a function is simply a value that has to be defined using only what is in its scope. This means that the "variable" containing the function value is outside of the scope of the function, and so cannot be referenced by it.

    • @aaravbhatt760
      @aaravbhatt760 2 ปีที่แล้ว

      @@AByteofCode Got it, good explanation

  • @alexander191297
    @alexander191297 2 ปีที่แล้ว +9

    This video: Explains lambda calculus.
    What my brain gets: *S U C C*

  • @LyricWulf
    @LyricWulf 2 ปีที่แล้ว +3

    2:15 yes that is always the first step

    • @garklein8089
      @garklein8089 2 ปีที่แล้ว

      love your videos, never expected to see you here

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      Interesting...
      (Also ooh, first verified comment, very nice :D)

  • @kvolikkorozkov
    @kvolikkorozkov 2 ปีที่แล้ว +5

    i only understood that functions are turing complete
    what a fun time my teacher will have trying to read my fully functioning code!

  • @japper12321
    @japper12321 2 ปีที่แล้ว +3

    I see two problems:
    1. Lambda calulus by itself has no semantics - saying that lambda abstraction is a function gives semantics for it. But lambda calculus are only the set of well-founded words, nothing else, there is no semantics about it.
    2. The way in which terms are reduced can be other than lazy, because Church-Rosser theorem says that no matter how we reduce, we'll end up with normal form if there is one.

  • @dgcp354
    @dgcp354 2 ปีที่แล้ว +16

    I never fully understand your video but still, it's short and I like it.

  • @olillin
    @olillin 2 ปีที่แล้ว +8

    Loving the new mic quality, and your content is both educational and entertaining. Keep it up!

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      Thanks man! Shall do :)

  • @markosth09
    @markosth09 2 ปีที่แล้ว +17

    I like to call λ calculus an unintentional esolang

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +3

      I totally agree lol

  • @zyansheep
    @zyansheep 2 ปีที่แล้ว +30

    Awesome! Can't wait for the y-combinator video. I've implemented my own lambda calculus evaluator, but I've never gotten the Y combinator to work correctly... probably because I forgot about lazy evaluation :)

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +5

      Sounds like that could be it. Good luck with that evaluator!

    • @aioia3885
      @aioia3885 2 ปีที่แล้ว +8

      you can use the Z combinator to do recursion in a language that implements strict evaluation order
      you don't even need branching primitives it's really cool

    • @aioia3885
      @aioia3885 2 ปีที่แล้ว +1

      I recently got the Y combinator to work in my lambda calculus evaluator
      I might be wrong but I think that for it to work you can't use applicative order of evaluation but you also can't use normal order of evaluation. I think the trick is to always perform the leftmost reduction

    • @aioia3885
      @aioia3885 2 ปีที่แล้ว +1

      correction: for an interpreter that correctly beta reduces lambda calculus terms you cannot use applicative order of evaluation but you can use normal order of evaluation if do you reductions at the head position until getting a head normal form. you can then proceeded to reduce the terms that are not in the head of an application
      see the wikipedia article for beta normal form for more details

  • @ruuku2743
    @ruuku2743 2 ปีที่แล้ว +3

    Your videos on functional design patterns made me learn functional programming!

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      I'm glad to hear that!

  • @angeldude101
    @angeldude101 2 ปีที่แล้ว +12

    Something that I find somewhat amusing is that if your lambda calculus is embedded in a more featureful language, it's actually pretty easy to convert from the lambda calculus representation to the higher level representation. For example, true True False = True, false True False = False to convert to a typed boolean. Similarly, numbers can be gotten by just passing a +1 function and a base case of 0.

    • @asdfghyter
      @asdfghyter 2 ปีที่แล้ว

      I also appreciate the reverse, that the `foldr` (or corresponding for other types, like `if` for bools) function converts an ordinary list into the church encoding of a list. And then giving cons (:) and [] to the church list/foldr gives back the ordinary list again. So we have a simple isomorphism between the two encodings.
      This is actually used for the optimization of list-fusion in Haskell. All of the list operations are converted into the corresponding version on church-lists, i.e. by using `foldr` and applying (:) [], then the generated functions are inlined and simplified using the normal function optimizations. This means that sometimes when you first generate a list, then do some operations on it and finally consume the list, the whole list can be optimized away so you only have a tight loop in the end.

    • @angeldude101
      @angeldude101 2 ปีที่แล้ว +2

      I actually wrote a small basic church encoding library in the Nix programming language, which provides a very succinct way to write untyped lambda calculus, and converting to and from the church encoding is about as short as the original definitions.
      nil = cons: nil: nil;
      cons = head: tail: cons: nil: cons head (tail cons nil);
      toChurch = lib.foldr cons nil;
      fromChurch = util.apply2 (h: t: [h] ++ t) [];

    • @asdfghyter
      @asdfghyter 2 ปีที่แล้ว +1

      @@angeldude101 Wait, why not just define toChurch as:
      toChurch = xs: cons: nil: lib.foldr cons nil xs
      Edit: I guess it's pretty similar to your definition, just that it moves the lambda inside the foldr instead of outside. Yours is also more direct from the definition of cons and nil for church lists.

    • @angeldude101
      @angeldude101 2 ปีที่แล้ว +2

      ​@@asdfghyter Also -Pointless- *Point-free* style.
      Nix's dynamic typing and extremely short lambda syntax makes it somewhat satisfying to write church-encoded values, even if it supports them first-class anyways. (The language is actually intended for a package manager, though it's really more of a build system and dependency manager.)

  • @remiwi2399
    @remiwi2399 2 ปีที่แล้ว +3

    Over the summer I tried to use Lambda Calc to make a very basic computer. While theoretically possible, simulating it with reduction is so slow that I had to stop. It took minutes to run even the most basic things!

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      One interesting thing to do is write a lambda calc interpreter than extend it with features until you eventualy have an actual programming language!

  • @PunmasterSTP
    @PunmasterSTP 2 ปีที่แล้ว +1

    After just coming across another video that dealt with lambda calculus, I'm trying to wrap my mind around something I don't fully understand yet. That said, your video took me a long way, and thank you so much for making such a great explanation!

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +2

      :D Good luck with your lambda journey! If you have any questions do not hesitate to ask

    • @PunmasterSTP
      @PunmasterSTP 2 ปีที่แล้ว +1

      @@AByteofCode Thank you, and that was lambdawfully kind of you to say!

  • @blueguy5588
    @blueguy5588 2 ปีที่แล้ว

    Wikipedia describes lambda calculus as "...a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution." This video makes that clear.

  • @otterlyso
    @otterlyso 2 ปีที่แล้ว +56

    Very clear! Looking forward to the Y combinator. And for that video would it be a good idea to use color so that arguments, when present on the right hand side, are yellow, for instance, while the function they are being are applied to is blue? Keeping track of what, at anyone time, is function and what is argument can be difficult.

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +13

      not sure how i'd do that but you're right, im gonna absolutely spend some time thinking about how to color code functions and arguments for maximum understanding
      im gonna be spending the next week streamlining my process so i can try making a schedule after that, so a color guideline could be something i work on

    • @willd4686
      @willd4686 2 ปีที่แล้ว

      How you gonna do that when it's all functions?

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      @@willd4686 yeah idk i thought about it but didn't find anything

  • @qedqubit
    @qedqubit 2 ปีที่แล้ว

    Tutorials like these are what mankind needs to grow towards enlightenment & unification 😃!

  • @Userjdanon
    @Userjdanon 2 ปีที่แล้ว +3

    I would like to get more insights about theoretical computer science topics such as these. There are lots of pure coding youtube creators. I think that you would be a great educator for theoretical cs!

  • @selfspectrum9369
    @selfspectrum9369 2 ปีที่แล้ว +3

    SS: I like your funny words, magic man 💖

  • @mr.duckie._.
    @mr.duckie._. 10 หลายเดือนก่อน

    this is the least you need for turing completeness:
    functions, variables, abstraction, numbers and -recursion- control flow (no goto)
    subtract x and y, and if that's negative or 0, goto z. and variables (yes goto)

  • @trp
    @trp 2 ปีที่แล้ว +2

    I like the succ function

  • @anywallsocket
    @anywallsocket 2 ปีที่แล้ว

    In a sense, this is trivial, in another it is pure genius .

  • @wlockuz4467
    @wlockuz4467 2 ปีที่แล้ว +2

    Now you know what I am going to create my next Javascript framework in!

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      o.o What horrors will come of this? Then again, I did have the idea of making a framework where instead of writing javascript you write html tags which define program logic and stuff :) Hello World

    • @wlockuz4467
      @wlockuz4467 2 ปีที่แล้ว

      @@AByteofCode So basically React? 🤣

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      @@wlockuz4467 from what i know in react you write html inside your javascript, im more thinking you write javascript as html

    • @wlockuz4467
      @wlockuz4467 2 ปีที่แล้ว

      @@AByteofCode oh so you mean plain html tags that can somehow express logic?
      That sounds disgusting, I would love to see it.

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      @@wlockuz4467 :) I'd wanna try a new format of showcasing horrible things I make so I'll definitively be doing that video someday

  • @uwuzote
    @uwuzote 2 ปีที่แล้ว +37

    Nice! I am fan of lambda calculus, but this is really good recap of this topic! Only small correction: parens aren't required to call fn-s, also, mentioning beta- and eta-reduction is worth it
    (Sorry for bad english)

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +15

      Good points, and thanks for the kind words! I hesitated mentioning those things, but found they weren't necessary for the core of the video. People are used to calling functions with brackets and its valid notation, so I didn't mention the other, also valid method.

    • @uwuzote
      @uwuzote 2 ปีที่แล้ว +2

      @@AByteofCode yea, i understand, but i think it's more natural/idiomatic

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +4

      @@uwuzote I do prefer the way it looks, just I had to cut out a lot of fluff to keep the video short so I stuck to the essentials lol

  • @Xayuap
    @Xayuap 2 ปีที่แล้ว

    I learned this by one of the ocaml writers.
    Ascander Suárez was my languages teacher.

  • @Simonheart13
    @Simonheart13 2 ปีที่แล้ว +2

    babe wake up new byte of code video

  • @WolvericCatkin
    @WolvericCatkin 2 ปีที่แล้ว

    Damn bud, you are really good at producing concise explanations of complex CompSci topics it's taken me years to grasp... 🤭

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      Thanks for the kind words!

  • @diedoktor
    @diedoktor 2 ปีที่แล้ว +3

    How did you pack so much info into 4 minutes? Amazing

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +5

      The secret is making it go so fast most people don't actually understand anything :)

  • @nuclearcatapult
    @nuclearcatapult 6 หลายเดือนก่อน

    I wish Mathematicians used lambdas, currying, and partial applications more often, and were more familiar with type theory and proof assisting compilers such as Coq, Agda, and Lean4. Perhaps if highschools offered 4 years of programming in the same way schools offered four years of math, we could see more Mathematicians lean towards constructivism.

  • @MetaMaths
    @MetaMaths 2 ปีที่แล้ว +1

    I want this to become a tutorial on FP ! Also, why church/ turing instead of Church/ Turing ?

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      I don't know about the capitalization thing. Otherwise, I think after the Y Combinator video I'm gonna take a break from functional programming to make videos on stuff I'm a bit more familiar with, but if I were to do a FP tutorial, what would you want in it?

  • @xXJ4FARGAMERXx
    @xXJ4FARGAMERXx 2 ปีที่แล้ว +2

    Can you actually explain what 0:41 actually means?
    As an example, let's say f(x) = 2x. If I have pseudo-code that looks like
    _a = 5_
    _f(5)_
    Now when I do _return a_ I should get 10.
    If I converted it to your format I have
    λa.(f(a))(5)
    Now, what does this actually mean??
    I understood when you said that λinput.output is equivalent to
    function(input) { return output } so when I try to change λa.(f(a))(5) into this format I get
    function(a) { return (f(a))(5) }
    And I still don't understand what (f(a))(5) means.

    • @garklein8089
      @garklein8089 2 ปีที่แล้ว +1

      when you convert it to his format, you get (λa.(f(a)))(5) (note the grouping)
      then, converting it to js-like, you get (function (a) { return f(a) })(5)
      you can see that in that function, `a` is bound to 5 despite us never using any variables

  • @xyzphyr
    @xyzphyr 2 ปีที่แล้ว

    I have ADHD so these short format videos are quite tasty

  • @legoenforcer7734
    @legoenforcer7734 2 ปีที่แล้ว

    very good job, I'm not really even sure what i'm learning at this point, but i figure if i just keep acrewing knowledge the dots should connect... at some point... theoretically

  • @asitisj
    @asitisj 4 หลายเดือนก่อน

    what does he mean by floating lambda here ?

  • @Zmunk19
    @Zmunk19 2 ปีที่แล้ว +1

    maybe it's just me but it was very difficult to keep up without rewatching two or three times

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      Definitively not just you lol. I try to fit too much into not enough time which makes things hard to grasp. I'm still trying to figure out the right rhythm!

  • @otesunki
    @otesunki 2 ปีที่แล้ว

    the hardest part is that its turtles all the way down

  • @widepootis
    @widepootis ปีที่แล้ว +1

    started taking functional programming classes two weeks ago, worst idea ever

    • @AByteofCode
      @AByteofCode  ปีที่แล้ว +2

      Once you get the hang of it, you'll at least sound smart

  • @timmydirtyrat6015
    @timmydirtyrat6015 2 ปีที่แล้ว +1

    Awesome video, but very fast paced, it's hard to comprehend without pausing and unpausing constantly

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      Very sorry about that. I'll try doing better in the future!

  • @gneryze
    @gneryze 2 ปีที่แล้ว +1

    I don't take collage and don't understand calculus, but your content so interesting it make me want to go to collage

    • @nekroxxigasmith1093
      @nekroxxigasmith1093 2 ปีที่แล้ว

      Just so you know, this video has nothing to do with "math" or university calculus, only the name is similar

    • @gneryze
      @gneryze 2 ปีที่แล้ว

      @@nekroxxigasmith1093 oh it do

  • @asdfghyter
    @asdfghyter 2 ปีที่แล้ว +2

    The Church encoding of lists (almost of the same as for numbers, but the function takes an extra element, corresponding to a single element in the list) is actually used for performance optimization in Haskell.
    The optimization is called list-fusion. All of the list operations are converted into the corresponding version on church-lists, by using `foldr` to turn a Haskell list to a Church-list and applying (:) [] to convert a Church-list to a Haskell-list, then the generated functions are inlined and simplified using the normal function optimizations. And any redundant cases of converting in one direction just to immediately convert it back are eliminated. This means that sometimes when you first generate a list, then do some operations on it and finally consume the list, the whole list can be optimized away so you only have a tight loop in the end.
    One cool thing about this optimization is that it is implemented completely in library-code. Nothing is built into compiler itself. The library code just tells the compiler “when you see this pattern, replace it with that pattern” and the rest falls out automatically.

    • @asdfghyter
      @asdfghyter 2 ปีที่แล้ว +1

      More concretely, we have:
      -- A list of `a`s is either an empty list or a single `a` followed by a list
      data List a = [] | a : List a
      -- This is the elimination rule for list and also converts a list to a church list
      -- > foldr f z [1,2,3]
      -- f 1 (f 2 (f 3 z))
      foldr :: (a -> b -> b) -> b -> List a -> b
      foldr f z [] = z
      foldr f z (x:xs) = f x (foldr f z xs)
      -- This function converts back from a chruch numeral to a list
      build :: (forall b. (a -> b -> b) -> b -> b) -> List a
      build curchList = churchList (:) []
      -- These two form an isomorphism, so
      -- foldr (:) [] xs = xs
      -- and
      -- foldr f z (build g) = g f z
      -- We tell the compiler to use the above simplification like this:
      {-# REWRITE “foldr/build” forall f z g. foldr f z (build g) = g f z #-}
      -- finally we can implement a function using this
      map :: (a -> b) -> List a -> List b
      map f as = build (\ cons nil -> foldr (\a bs -> cons (f a) bs) nil as)
      {-
      -- corresponds to this:
      map f [] = []
      map f (a:as) = f a : map f as
      -}
      And now finally, if we were to call map twice, the two uses would automatically fuse together:
      map f (map g list)
      = build (\ cons nil -> foldr (\a bs -> cons (f a) bs) nil (build (\ cons' nil' -> foldr (\a' bs' -> cons' (g a') bs') nil' list)
      ))
      -- use the foldr/build rule
      = build (\ cons nil -> foldr (\a' bs' -> (\a bs -> cons (f a) bs) (g a') bs') nil list)
      = build (\ cons nil -> foldr (\a' bs' -> cons (f (g a')) bs') nil list)
      = map (\x -> f (g x)) list
      which is exactly the simplification we wanted

  • @codexed-i
    @codexed-i 2 ปีที่แล้ว +1

    Just write a lambda calculus interpreter.

  • @MrRedstonefreedom
    @MrRedstonefreedom ปีที่แล้ว

    I like the video and it's great to have such a fast-running & dense video, but it is annoying to want to soak-in the visuals, but need to constantly be back-skipping.
    Maybe have an extended video where you just re-use the same stuff, but just slow down.
    Essentially, this would be the "TL:DT" (too long, didn't think) version, and the other would be if you want to soak-in the visuals.
    But if I had to choose one vs the other, i'd go with this one, as the video could just be replayed a few times. I don't think that's the ideal though for how humans internalize; pacing has value.

    • @AByteofCode
      @AByteofCode  ปีที่แล้ว

      I agree, this video was too fast. I think when you spend an hour on 15 seconds of content, and when you can't get live previews (i had a much worse pc when i made that video), you really don't notice the pace. That's the main thing I need to work on for future content, and I'll probably revisit these couple of videos to make them more accurate and understandable!

  • @howareyou4400
    @howareyou4400 2 ปีที่แล้ว

    "If you don't understand it, don't worry, it will make sense relatively soon" X 9
    "then end"

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      by soon i meant about 3 weeks lmao

  • @kellersefi
    @kellersefi 2 ปีที่แล้ว

    Great video! How much time does it take you to edit?

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      Each video takes about 40 hours to make including all the research and stuff :|

    • @kellersefi
      @kellersefi 2 ปีที่แล้ว

      @@AByteofCode that's a lot! There are tools that automate parts of the editing process. Maybe they can save you some time.

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      ​@@kellersefi I'm constantly thinking about ways to make the process more efficient. I've noticed that the more practical a video is, the less time it takes to make, so I might try to lean in that direction. Also shorter videos perform a lot better, and are easier to make, so that's another method of optimization. Other than those two, there isn't a lot of time saving I could do before starting to outsource some of the work

  • @ryuk5709
    @ryuk5709 ปีที่แล้ว

    And that's why we use imperative languages

  • @rpxdytx
    @rpxdytx 2 ปีที่แล้ว

    In summary, functions are little pieces categorized as turing complete, aka, made in hell

  • @rusluck6620
    @rusluck6620 ปีที่แล้ว

    tf is \b.b(false)(true) supposed to mean?

    • @AByteofCode
      @AByteofCode  ปีที่แล้ว

      In JS that would make "bool => bool(valueiffalse, valueiftrue)"
      So if instead of bool being a function but was an actual boolean, it'd be, in python "valueiftrue if bool else valueiffalse"

  • @Maartz
    @Maartz 2 ปีที่แล้ว +1

    Me: Wait, it was just LISP ?
    (): (always has been)

  • @gm2407
    @gm2407 8 หลายเดือนก่อน

    Sometimes existiance feels like lambda calculus and we are adaptive functions because we change with every experience. Maths and the nature of the universe is complicated.

  • @MiTheMer
    @MiTheMer 2 ปีที่แล้ว

    Interesting video, but honestly if this is meant to actually teach something (more than just the binary knowledge "yes, it's theoretically possible to do this"), how about showing some real code executed etc.? Is there a language which supports this kind of chained lambdas?

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      Uh haskell technically has lambda expressions, and python has a "lambda" keyword but both of these work a bit differently to what this video explained. Ultimately, while there are some interpreters for lambda calculus, its still calculus and programming in this is about as worth doing as using brainf*ck: its fun but not useful :)

    • @MiTheMer
      @MiTheMer 2 ปีที่แล้ว

      @@AByteofCode Okay, that makes sense. Am mostly watching programming vids so I came to this video with a wrong mindset :)

  • @eldattackkrossa9886
    @eldattackkrossa9886 2 ปีที่แล้ว

    is the description here correct? looks like some wip stuff is left over :) good vid tho

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      lmao forgot to remove that, thanks for pointing it out!

    • @eldattackkrossa9886
      @eldattackkrossa9886 2 ปีที่แล้ว

      @@AByteofCode gotcha 😎

  • @Templarfreak
    @Templarfreak 2 ปีที่แล้ว +3

    i did not understand a single thing here.

  • @siquod
    @siquod 2 ปีที่แล้ว +2

    Your multiplication and exponentiation operators are needlessly complex. If done right, they are simpler than addition. For example, exponentiation is just reverse function application!

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      "reverse function application" please elaborate
      also yeah my resident lambda expert told me about the simpler methods but the one showed was the most intuitive and so best choice for a quick intro :)

    • @siquod
      @siquod 2 ปีที่แล้ว +1

      @@AByteofCodeWell, if (f x) denotes the function f applied to the argument x, and if b and n are Church numerals, then (n b) is the Church numeral for bⁿ. I agree that it is not immediately obvious why this is so. It's a fun exercise to wrap your head around it.
      What's easier to understand is that the product of two Church numerals m and n is (λs → (m (n s))). To understand this, it helps to think about Church numerals as accepting a "stepper function" and a "starting value". The numeral c first converts the stepper function argument into its n-fold iterate and then applies it to the starting value. That's the same as applying it c times in a row to the starting value, but we don't need to know the starting value in order to form the c-fold iterate of the stepper function. If s is a stepper function (e.g. (λv → (v + 1)), but could be anything), and we feed it to the Church numeral n, we get back its n-fold iterate (In the example, this would be (λv → (v + n)). This has also the same type of a stepping function as s, so if we feed it to m, we get the m-fold iterate of the n-fold iterate of s, which is the m×n-fold iterate of s. This definition of multiplication is more concise, because it doesn't even mention the starting values, but operates on the stepper functions. It is slightly more abstract because it uses the concept of higher order functions and never goes down to the level of "concrete values", but IMO this abstraction pays of because in lambda calculus, there are no "concrete values", it's functions all the way down and this way to define multiplication does it justice.

  • @Leonhart_93
    @Leonhart_93 8 หลายเดือนก่อน

    Sure, it's also a way to write something that ensures you are the only one who can ever understand what that thing does. Or maybe not even you.

    • @AByteofCode
      @AByteofCode  8 หลายเดือนก่อน

      Think of it as the extreme sports of programming. It’s an interesting challenge but definitely not meant for production (I mean division has a complexity of n^6 if I remember correctly)

    • @Leonhart_93
      @Leonhart_93 8 หลายเดือนก่อน

      @@AByteofCode Yeah. I have however seen many serious proponents for purely functional programming, with extremely no-chill restrictions and all, and I must say I have no idea how they are going to integrate that in a team.
      I imagine people like it because it makes them feel smart, but I would rather not make separate functions to avoid a + b or complicated recursion nesting to avoid a simple loop 😂

    • @AByteofCode
      @AByteofCode  8 หลายเดือนก่อน

      @@Leonhart_93 I find that my imperative code has been less buggy since I learnt some functional principles. Keeping an eye on side effects for example, is a pretty good idea. IMO, write code with a mix of both, as they both have some solid advantages and aren't completely incompatible

    • @Leonhart_93
      @Leonhart_93 8 หลายเดือนก่อน

      @@AByteofCode Sure, some principles are nice to understand, like trying to use more pure functions instead of having too many side effects.
      BUT, I will never get to the point of chaining 5 functions together just so that I avoid doing "if (x % 2) a += b; " 😂

  • @azeton128
    @azeton128 2 ปีที่แล้ว

    I am watching this at 01:27am and didn’t program for more than 12 years

  • @federicoagustinsawadyoconn2716
    @federicoagustinsawadyoconn2716 7 หลายเดือนก่อน

    And also, it's all about this: en.wikipedia.org/wiki/SKI_combinator_calculus

  • @alejrandom6592
    @alejrandom6592 2 ปีที่แล้ว

    Is this #some2 ?

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      Some2 ended a few weeks before i uploaded this, which is a shame because this video would have fit as a some2 submission

  • @paxdriver
    @paxdriver 2 ปีที่แล้ว

    Omg well done dude

  • @sempersolus5511
    @sempersolus5511 2 ปีที่แล้ว +3

    Whenever people on the internet make me feel smart in comparison, I try figuring out functional programming again.
    That usually lowers me back to baseline.

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      Dunning krueger effect bypass :)

    • @LambdaJack
      @LambdaJack 2 ปีที่แล้ว

      Because proper explanation wouldn't be "functional" and even less "lambda". It means you are thinking. It is like studying division through Roman Numerals. What a wonderful theory and exposition would it be.

  • @Rudxain
    @Rudxain 2 ปีที่แล้ว +3

    The way variables are defined made me realize that global vars are impossible in this lang! I see this as an absolute win, lol.
    In addition (pun indented (pun intended too (there's a typo, read twice (I think I have too many parentheses, this looks like Common Lisp)))), vars are only available within the strict scope in which they were defined, forcing vars to always be private and local, and encouraging devs to pop the vars from the stack ASAP, thereby reducing memory usage as a side-affect (pun intended too)

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +2

      Two many puns in that comment :)

  • @electroflame6188
    @electroflame6188 2 ปีที่แล้ว +1

    Would be interested in a video on how horn clauses are turing complete.

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      added that to my "stuff to research" list :)

  • @principleshipcoleoid8095
    @principleshipcoleoid8095 ปีที่แล้ว

    Inline functions are also nice

    • @AByteofCode
      @AByteofCode  ปีที่แล้ว

      In python, inline functions are made with the "lambda" keyword so i'd argue they're mostly the same (except inlines are more practical since you can have other stuff in it)

  • @RedStone576
    @RedStone576 2 ปีที่แล้ว

    awesome

  • @ianmccubbin7575
    @ianmccubbin7575 2 ปีที่แล้ว +1

    Can we talk talk about why something called the "succ()" function exists 😂

  • @dragolov
    @dragolov 2 ปีที่แล้ว

    Respect!

  • @stasglazkov8734
    @stasglazkov8734 2 ปีที่แล้ว

    Thats kind of misleading imo. Because you go beyond what functions do. Specifically you define one. But doesnt it mean that syntaxis is turing complete and not the functions?

    • @stasglazkov8734
      @stasglazkov8734 2 ปีที่แล้ว

      Its like there is something you can only do at home and the statement goes: In order to do A you need to go home first.
      Then you go home independently of doing A. Make sure you stay within the contains of home by not leaving it and make a video YOU NEVER NEED TO GO HOME TO DO A EVER AGAIN presenting your case where you are at home and have everything you need AND work with select few things that inherently dont require you leaving your home. Its defining the function that is turing complete and not the function. For that matter you could define anything and make it do computations. Just depending on your selection you get some things for free and some by workarounds.
      Try doing the same in the universe of Plato where you have mathematical ideals of functions. You will quickly realise how functions dont do shit on their own and its basically you mind that expands their capacities to turing completeness.

  • @planktonfun1
    @planktonfun1 2 ปีที่แล้ว

    its a function, ok great it can do most of the things, but I failed to understand how it is" turing complete" was it all just clickbait?

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      Generally, a turing complete system is capable of conditional looping and logic. While I didn't specifically prove TCness, its really hard to do that so we just stick to the signs, which is the interesting stuff.
      I do get where you're coming from and I'm gonna try and find ways to incorporate proofs of TCness in future videos of the format "why ... is TC"

  • @user-pr6ed3ri2k
    @user-pr6ed3ri2k 2 ปีที่แล้ว +1

    turn(i(ing?)?) value
    booea

  • @user-pr6ed3ri2k
    @user-pr6ed3ri2k 2 ปีที่แล้ว +1

    and4

  • @AdrX003
    @AdrX003 2 ปีที่แล้ว

    Oh my

  • @im-essi
    @im-essi 2 ปีที่แล้ว

    basic, but clean! neat :)

  • @ccgarciab
    @ccgarciab 2 ปีที่แล้ว

    Now do SKI calculus

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      Someday lol, but don't worry its on my mind :)

    • @ccgarciab
      @ccgarciab 2 ปีที่แล้ว

      @@AByteofCode wooh, didn't expect that you'd actually do it, but I'm happy

  • @TheMightyShell
    @TheMightyShell 2 ปีที่แล้ว

    I understood nothing and I had fun

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +1

      So I give off the same experience as school :)

  • @leptosurreal460
    @leptosurreal460 2 ปีที่แล้ว

    ... What?

  • @saroamirkhanyan
    @saroamirkhanyan 2 ปีที่แล้ว

    Beauty 🙂

  • @user-pr6ed3ri2k
    @user-pr6ed3ri2k 2 ปีที่แล้ว +1

    noparency data fites

  • @heliusuniverse7460
    @heliusuniverse7460 ปีที่แล้ว

    I don't know who i am... I don't know why i'm here
    All i know is a monad is a monoid in the category of endofunctors

  • @krawieck
    @krawieck 2 ปีที่แล้ว

    thanks for this video, now i know that i never want to study lambda calculus :)

  • @user-pr6ed3ri2k
    @user-pr6ed3ri2k 2 ปีที่แล้ว +1

    thecangculus

  • @SuperchargedCow
    @SuperchargedCow ปีที่แล้ว

    What the hell just happened? Very good explanation, but i don't have a clue what you're talking about fella, not a damn clue i tell you. Do you have any soup? 🙏

    • @AByteofCode
      @AByteofCode  ปีที่แล้ว

      I have some onion soup if you want

  • @TuMadre8000
    @TuMadre8000 2 ปีที่แล้ว

    jesus, this looks like hell

  • @user-pr6ed3ri2k
    @user-pr6ed3ri2k 2 ปีที่แล้ว +1

    wizonly future

  • @user-pr6ed3ri2k
    @user-pr6ed3ri2k 2 ปีที่แล้ว +1

    oragate

  • @shaileshaanand
    @shaileshaanand 2 ปีที่แล้ว +3

    It succs🤣

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว +3

      Just like the zucc

  • @user-pr6ed3ri2k
    @user-pr6ed3ri2k 2 ปีที่แล้ว +1

    loadinginup

  • @funmath3835
    @funmath3835 2 ปีที่แล้ว +1

    haskell

  • @rusluck6620
    @rusluck6620 2 ปีที่แล้ว

    well
    ```
    int x()
    {
    return 5
    }
    ```

  • @fromant65
    @fromant65 ปีที่แล้ว

    Oh man I hate lambda calculus with my soul, what a twisted idea

  • @user-pr6ed3ri2k
    @user-pr6ed3ri2k 2 ปีที่แล้ว +1

    binarian

  • @maxron6514
    @maxron6514 2 ปีที่แล้ว

    Wat

  • @user-pr6ed3ri2k
    @user-pr6ed3ri2k 2 ปีที่แล้ว +1

    nouhdup timez
    ack 1

  • @MeanSoybean
    @MeanSoybean 2 ปีที่แล้ว

    it's way too fast goddamn

  • @Dreadwinner
    @Dreadwinner 2 ปีที่แล้ว

    🙀

  • @vikingthedude
    @vikingthedude 2 ปีที่แล้ว

    f

  • @Lucas_strable
    @Lucas_strable 2 ปีที่แล้ว

    Λ λ

  • @user-pr6ed3ri2k
    @user-pr6ed3ri2k 2 ปีที่แล้ว +1

    sordof moudup time
    wide times

  • @carloselmaestro6369
    @carloselmaestro6369 2 ปีที่แล้ว

    Hey do you have a Instagram or anything were I can get in contact with you?

    • @AByteofCode
      @AByteofCode  2 ปีที่แล้ว

      Discord is preferable: iWaroz#6869, otherwise email (check my channel business email)
      Worst case scenario @abyteofcode on instagram but reply to this so i actually check it

  • @klembokable
    @klembokable 8 หลายเดือนก่อน +1

    great thumbnail

    • @AByteofCode
      @AByteofCode  8 หลายเดือนก่อน

      Thank you!!