Curried Functions - Computerphile

Sdílet
Vložit
  • čas přidán 5. 09. 2024

Komentáře • 298

  • @jonathandannel8712
    @jonathandannel8712 Před 3 lety +41

    "Well, maybe on a Saturday night, when you've been out, you try and put all 3 inputs in at the same time.."
    Graham is so funny without even trying to be. His explanations are always on point, too. Great video.

  • @kevinbee4617
    @kevinbee4617 Před 4 lety +44

    The fact that functions in Haskell are curried by default explains the function signatures with multiple arrows.
    "add x y = x+y" has the type *"Integer -> Integer -> Integer"* A function that takes and Int and produces another function that takes another Int and produces an Int
    "add (x y) = x + y" has the type "(Integer, Integer) -> Integer" - Like you would expect in Java "int add(int x, int y) {return x + y;}".
    By the way, that notation is a fancy way to write "add pair = (first pair) + (second pair)". It really only has *one* parameter "pair".

    • @alpergunes6380
      @alpergunes6380 Před 3 lety +1

      So the truth what is underlying here "functions are exactly take only one argument". When you call a function with two arguments, you are actually calling a function with one "pair".

    • @kevinbee4617
      @kevinbee4617 Před 3 lety +4

      @@alpergunes6380 In Haskell you could create a multi-argument function, by passing it a list or a tuple. That's what I have done in the "Java" example. In actual Java, you can have multiple parameters.
      Typically in Haskell, you wouldn't use tuples or pairs though, but currying, which is different.
      In currying you pass the first argument to a function with one argument, which then returns another function and then you pass the second argument to that new function to get the end result.
      x = add 4 5
      is the same as
      x = (add(4))(5)
      t = add(4) -- t is a "4 adder"
      x = t(5) -- putting 5 in a 4-adder gives 9

    • @RonInbar
      @RonInbar Před 2 lety

      It's not `add (x y)`, it's `add (x, y)`. The comma is important. Without it, `add (x y)` means `(add . x) y`. I.e. apply x to y, then apply `add` to the result.

  • @thoperSought
    @thoperSought Před 2 lety +4

    0:10 _"... which sound a bit spicy, but are actually very useful."_
    excellent delivery, Professor Hutton.

  • @Jopie65
    @Jopie65 Před 4 lety +126

    I miss an (I think) intuitive example I use often to demonstrate currying. Something like:
    add x y = x + y
    addFour = add 4
    addFour 5
    9
    addFour 6
    10

    • @StephenCrespo
      @StephenCrespo Před 4 lety +41

      This makes more sense than the entire video

    • @aymanayman9000
      @aymanayman9000 Před 4 lety

      I know but to think about curried functions I think you need to think in terms of assembly line where you can change what line does by changing a part of it it's not the only way maybe you can use callback but you must consider also that this is a mathematical way of thinking maybe those are wrong reasons or maybe there are other reasons I'm not sure but that's how I think about it

    • @WoLpH
      @WoLpH Před 4 lety +13

      When he was starting to explain the curry with the add function I was really expecting this example. The map example wasn't wrong but much more complicated than it needed to be.

    • @zecosta9579
      @zecosta9579 Před 4 lety +6

      This example would have been the perfect ending to the video, thank you for posting it :)

    • @user255
      @user255 Před 4 lety +5

      I think your example is better, than what the video gave, but I still don't see any use for this feature. The normal way is more clear and practically equally long:
      add(x, y) = x + y
      addFour(x) = add(x, 4)

  • @clairearan505
    @clairearan505 Před 3 měsíci

    You should know that you're the first person who has successfully managed to get me to understand a shred of functional programming. Many have tried. Thank you!

  • @richardjames712
    @richardjames712 Před 4 lety +61

    First time I've actually understood currying - or at least, I'm starting to understand it now. Many thanks.

    • @Pacvalham
      @Pacvalham Před 4 lety +5

      This is probably the simplest explanation of currying:
      Regular functions take all of the inputs at once.
      Curried functions take one input and return another function that takes the next input (or the result if it's the last input).

    • @papikabron18
      @papikabron18 Před 4 lety +2

      This makes javascripting easier

  • @letMeSayThatInIrish
    @letMeSayThatInIrish Před 4 lety +59

    I will call them "Schönfinkeled functions' from now on.

  • @PaulBunkey
    @PaulBunkey Před 4 lety +92

    8:57 *Looks at perfectly understandable expression* "Let's make it clear what's going on",
    *writes Haskel notation gibberish*

    • @rogerbosman2126
      @rogerbosman2126 Před 4 lety +11

      The point of the notation is to make it explicit that a curried function is a function taking a single argument and then returns a function. By including the explicit lambda notation it ismuch more clear that what is returned is actually a function that takes the next argument.
      The notation is not difficult. foo x = x is the same as foo = \x -> x

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 Před 4 lety +2

      There is failyr standard lambda-calculus notation, e.g.
      f = λx.x
      But I agree, that Haskell notation doesn’t make any sense to someone who doesn’t know Haskell.

    • @jeromesnail
      @jeromesnail Před 4 lety +3

      @@lawrencedoliveiro9104 it does make perfect sense for those who know about maths though.
      It's like arrow functions in JavaScript, the notation make it very clear that the function is something that given an argument x, returns something that depends on x.

    • @rikwisselink-bijker
      @rikwisselink-bijker Před 4 lety +2

      I think this is actually the first video with him that wasn't totally pointless and boring for people who don't know Haskell (nor have any interest in learning it)

  • @myguitardidyermom212
    @myguitardidyermom212 Před 2 lety +1

    Prof. Hutton has a real gift for making complicated concepts easy to understand for

  • @jorgejarai
    @jorgejarai Před 4 lety +66

    I demand the new world currency must be the Brailsford (with the generic currency ¤ as its symbol)

    • @QuantumFluxable
      @QuantumFluxable Před 3 lety

      that's no generic currency, it's dwarf bucks!

    • @Twisted_Code
      @Twisted_Code Před 3 lety

      okay I must be missing context here. Care to explain?

    • @QuantumFluxable
      @QuantumFluxable Před 3 lety

      @@Twisted_Code that's the symbol used for currency in the video game dwarf fortress, the community calls it dwarf or dorf bucks :)

    • @jorgejarai
      @jorgejarai Před 3 lety

      @@Twisted_Code Of course.
      The ¤ symbol is used when you're talking about an unspecified currency (not euros or dollars, but a hypothetical unit). I think it'd look neat in a real world situation

    • @Twisted_Code
      @Twisted_Code Před 3 lety

      I'm still not following how this all relates to the video? Are you referring to the cash machine part of the video?

  • @IIARROWS
    @IIARROWS Před 4 lety +36

    I never knew about curried functions. At the beginning I was sceptic about being an April Fools video.
    The conviction grew, then I realized it made sense.

    • @Gamesaucer
      @Gamesaucer Před 4 lety +3

      It does sound like it could be a joke, especially with the thumbnail. Still, it's actually pretty useful to realise currying/partial application is a thing. Wish they'd delayed it a bit because I bet some people skipped the video thinking it's a joke.

  • @agivney
    @agivney Před 4 lety +4

    Great explanation. I like how you explain how to apply this to the map function, this makes the concept clear.

  • @omgomgomgd
    @omgomgomgd Před 4 lety +45

    that's a funny topic to pick on april first, there are people who won't think this is a real thing.

    • @deltav9784
      @deltav9784 Před 4 lety +1

      That's why i'm watching this video lol

    • @matsonnerby
      @matsonnerby Před 4 lety +3

      Exactly. I was hoping for a 1 April joke. Noop

    • @superscatboy
      @superscatboy Před 4 lety +4

      There's no way Haskell can be a real thing.

    • @3dlabs99
      @3dlabs99 Před 4 lety

      Yeah this april 1st joke is BOOORING

  • @Marc-tm4xh
    @Marc-tm4xh Před 4 lety +45

    I feel like he skipped over a pretty big reason you would even want to use currying, which is being able to "pre-compute" (there's got to be actual terminology for this) part of your function, potentially saving you a lot of computation over multiple iterations. Similar to memoization, except that in this case the function itself is acting as your "cache". Or am I completely wrong here?

    • @michaela244
      @michaela244 Před 4 lety +2

      I've used this with spline interpolation once. Interpolation involves solving a system of linear equations, a fairly expensive process, but once it's done you can use the results to compute the interpolated value in any number of points. So using currying felt like an obvious choice. I've done the same assignment also in C, and it sure felt nice to be able to say at the end of the process: now I have a function from reals to reals, don't worry about the details.

    • @MPnoir
      @MPnoir Před 4 lety +14

      You mean partial evaluation?

    • @monnef
      @monnef Před 4 lety +3

      It can be seen as a memoization of its partially applied arguments. In the case of Haskell, it really doesn't matter, because it's a pure functional language so values get memoized automagically (e.g. when `factorial 100` is called first time, it gets computed, but if `factorial 100` is needed again, anywhere, result is just loaded from memory and it won't be computed again).

    • @yogiturtleseraph8208
      @yogiturtleseraph8208 Před 4 lety +6

      When I heard of it the first time, the problem to solve was: how to have multiple parameters functions in a language that just allow single parameter functions (aka lambda calculus). That is pretty big.

    • @luismiguel.b
      @luismiguel.b Před 4 lety

      It is called partial application function

  • @nO_d3N1AL
    @nO_d3N1AL Před 4 lety +10

    Excellent video - should be on the tutorial page for Haskell. Well-explained, understandable but not overly simplified or verbose.

  • @yommish
    @yommish Před 8 měsíci

    As someone who is not a programmer it is curious about it, this video is the first time I’ve actually understood fundamentally how functional programming is different from object oriented programming and how it could be useful. It just made something in my brain click.
    Although reading the other comments made me confused again.

  • @SakataSamig
    @SakataSamig Před 4 lety +6

    Just what I needed. Been a bit confused witn curried function or high order function.

  • @skyburngames7381
    @skyburngames7381 Před 3 lety

    Very clear explanation of curried functions, higher-order functions, and lambda expressions, worth the 10 min watch!

  • @nilp0inter2
    @nilp0inter2 Před 4 lety +1

    The best functional programming teacher out there!

  • @xichaopeng7904
    @xichaopeng7904 Před 4 lety

    Thanks for having Mr. Fincher as a guest I love his work

  • @zewdiherring9528
    @zewdiherring9528 Před 2 lety +1

    Cash machine example made it all come together!

  • @haos4574
    @haos4574 Před 2 lety +1

    You made me understand at exactly 6:20 - 6:30, it's so clever! Thank you!

  • @BinaryReader
    @BinaryReader Před 4 lety +33

    Haskell doesnt help explain these concepts. Something with a less esoteric syntax would be more understandable. From a haskell programmer.

    • @Bayo106
      @Bayo106 Před 4 lety

      Yea it's a ibt weird they chose this. Maybe they did it because Haskell is a functional language?

    • @BinaryReader
      @BinaryReader Před 4 lety +1

      @Sydney Bean JavaScript perhaps?
      const f = x => y => x + y ?

    • @technicalfool
      @technicalfool Před 4 lety +1

      @Sydney Bean
      From ruby-doc.org:
      def foo(a,b,c)
      [a, b, c]
      end
      proc = self.method(:foo).curry
      proc2 = proc.call(1, 2) #=> #
      proc2.call(3) #=> [1,2,3]

    • @evergreen-
      @evergreen- Před 4 lety

      I think Swift’s syntax makes most sense. You can see clearly what types are expected in the definition:
      func plus(_ a: Int) -> (_ b: Int) -> Int {
      return { b in
      return a + b
      }
      }
      let plus5 = plus(5) // (Int) -> Int
      plus(5)(4) // 9
      plus5(4) // 9

    • @NiDeCo
      @NiDeCo Před 4 lety

      @@evergreen- If you put the type definition with the function in Haskell, it's even easier to see what's happening IMHO
      plus :: Int -> Int -> Int
      plus a b = a + b
      -- or plus = \a -> \b -> a + b
      Putting the type definition above top-level functions is common practice in Haskell, he just didn't do it because it was in a REPL and explaining types wasn't in the scope of the video.

  • @victoriakee61
    @victoriakee61 Před rokem

    Thank you, thank you, thank you for breaking it down with the cash machine problem.

  • @danielchequer5842
    @danielchequer5842 Před 4 lety +2

    This video actually made me hungry for hearing curried so many times

  • @valtersanches3124
    @valtersanches3124 Před 10 měsíci +1

    So it works exactly as a state machine? Takes in a single parameter at a time and updates it's internal state accordingly until it completes it's purpose

  • @frognik79
    @frognik79 Před 4 lety +112

    Take a shot every time he says "function".

    • @jakegore759
      @jakegore759 Před 4 lety +10

      did this, am currently having my stomach pumped

    • @BicyclesMayUseFullLane
      @BicyclesMayUseFullLane Před 4 lety +4

      Well given he is talking about a functional programming concept, I hope you don't get alcohol poisoning from that.
      Edit: welp, too late.

    • @SteelSkin667
      @SteelSkin667 Před 4 lety +2

      chjAlleNge aCCcepted

    • @RussellRiker
      @RussellRiker Před 4 lety +1

      1 shot, 2 shots, 3 shots, floor.

    • @yyny0
      @yyny0 Před 4 lety

      those functional programmers and their functions...

  • @DanieleFilaretti
    @DanieleFilaretti Před rokem

    loved the cash machine example! great video!

  • @ahmadshwaiki5744
    @ahmadshwaiki5744 Před 2 měsíci

    simple yet very helpful indeed, thank you

  • @the_niss
    @the_niss Před 4 lety +1

    The cashmachine is a very good example

  • @moritzschmidt6791
    @moritzschmidt6791 Před 4 lety

    One example that helped me to understand currying in Haskell:
    (>) is defined as: Ord a => a -> a -> Bool
    filter is defined as: (a -> Bool) -> [a] -> [a]
    If you want to filter all elements > 4 from a list, you can do it like so:
    filter (>4) [1..10]
    Since (>4), which is curried, is defined as: (Ord a, Num a) => a -> Bool
    It can be passed to filter.

  • @washingtonlgois
    @washingtonlgois Před 2 lety

    Wow, the example of the cash machine made so easier to understand this! Thank you so much!

  • @huycao8521
    @huycao8521 Před 3 lety +1

    thank you for the great content :D

  • @albertofabbri1543
    @albertofabbri1543 Před 3 lety +1

    Thank you very much for the very clear explanation!

  • @inversnone
    @inversnone Před 4 lety +2

    Computerphile and Graham Hutton have been delivering quite a nice slew of videos lately. Would you mind grouping them into a playlist? Would be easier to know if I'm missing something.

  • @nihilistbookclub5370
    @nihilistbookclub5370 Před 4 lety +3

    Hey, can you make a video explaining root files and the CERN ROOT system? it's slightly more complex than i thought it would be

  • @jimgolab536
    @jimgolab536 Před 4 lety

    This is very clear. The motivating cm example at the end was extremely helpful. Thanks!

  • @savaged
    @savaged Před rokem

    Excellent explanation of currying and even better comic timing!!

  • @0x6e95
    @0x6e95 Před 4 lety +1

    Being new to Haskell (I've heard of it but haven't really familiarized myself with its syntax), that initial example of currying confused me a bit. Perhaps it would have been better if he first expressed it explicitly with lambda functions.

  • @ntzst1018
    @ntzst1018 Před 4 lety +17

    Study with zoom day 10:🤦
    Computerphile new video:💃

  • @HasanBasri-vf2kg
    @HasanBasri-vf2kg Před 2 lety

    Thank you very much for clear explanations to understand the topic

  • @indonesiamendaurulang
    @indonesiamendaurulang Před 2 lety

    this is really a very easy to understand explaination, much thanks !!

  • @mr7clay
    @mr7clay Před 4 lety +1

    Does Haskell automatically memoize curried functions? Like if `add x` did some expensive calculation, and you stored `addFive = add 5`, would addFive 7 re-perform the calculation? In JS the args would be captured in the closure, but all the execution would repeat.

    • @NiDeCo
      @NiDeCo Před 4 lety +1

      No, but it does do inlining when possible, which is even more efficient than memoizing.

  • @JNCressey
    @JNCressey Před 4 lety +1

    why does it give an error instead of maybe a little description saying that it's returned a function?

    • @DutchmanDavid
      @DutchmanDavid Před 4 lety +1

      That's because Haskell's error messages are dreadful! Elm (a language based on Haskell) does a *much* better job, but only transpiles to JS, so its area of usage is different.

  • @georganatoly6646
    @georganatoly6646 Před 4 lety +3

    I think a 'curried' function falls into the category of something that most programmers know and use often but doesn't know to call them 'curried' functions. I actually find not naming some things in computer science to be more beneficial for communication rather than obfuscating frequent, naturally arising patterns behind unnecessary jargon. Jagged arrays in C# is another example.

  • @immabreakaleg
    @immabreakaleg Před 3 lety +1

    concept in python:
    ```
    def curried_f(x):
    return lambda y: x + y
    print(curried_f(2)(3))
    ```

  • @xybersurfer
    @xybersurfer Před 4 lety

    i would say that Schönfinkel's contribution is the most important one to lambda calculus

  • @kenziephillips
    @kenziephillips Před 4 lety +1

    Is it just me or are curried functions just internal state with more steps? Not very functional of them...
    But in all seriousness, thanks for the simple explanation.

    • @kenziephillips
      @kenziephillips Před 4 lety

      @Mike Yeah that makes sense. I was thinking that the state was changing, but in the case of add, it only changes once and in an entirely predictable way.

  • @firstnamelastname2805
    @firstnamelastname2805 Před 4 lety +8

    Thanks for trying, but this video makes curried functions seem unnecessary and confusing...🤔

    • @jpisello
      @jpisello Před 4 lety +1

      They can be really useful when you need to "carry around" a value that you want to use with some additional function later, perhaps long after the original value has gone out of scope.
      They can also be really confusing :-)

    • @misterhat5823
      @misterhat5823 Před 4 lety +3

      Exactly what I was thinking. He explained what they are clearly enough, but I can never see where I'd care.

  • @ReddSpark
    @ReddSpark Před 3 lety +1

    1. I didn't get 4:28 - it's literally saying you should didn't give two values , so how does that prove the point about not needing to give two values at the same time?
    2. The example at the end finally made something click - will now watch it all a second and possibly a third time!
    3. Second viewing and I'm now even more confused. Weill look for another video.

  • @theQuickRundown
    @theQuickRundown Před rokem

    "Schönfinkeled functions" sounds so fancy, should rename it :D

  • @2eath
    @2eath Před 4 lety

    The examples don't really explain what the difference of input arriving one at a time vs all at once from a software point of view. To me they are the same. This makes sense if is applied to a real hardware. Am I to understand that this curried function is generally more applicable to hardware implementations?

  • @nerdophile6945
    @nerdophile6945 Před 4 lety +22

    Curried function, sounds a bit spicy. I see what you did there!!

  • @guanche011
    @guanche011 Před 4 lety +12

    Those Haskell error messages need some work :)

  • @Tweakimp
    @Tweakimp Před 4 lety +6

    It would be easier to follow if you had him as picture in picture in a corner and not constantly switch between him and the code.

  • @edgbaston149
    @edgbaston149 Před 2 lety

    Thank you so much

  • @roberthunter5059
    @roberthunter5059 Před 4 lety +6

    I've always wondered how HP calculators were programmed.

    • @Bin216
      @Bin216 Před 4 lety

      Robert Hunter HP calculators often throw reverse polish notation into the mix as well...

  • @AaronTheGerman
    @AaronTheGerman Před 4 lety

    Why use inc if you can have the succ?

  • @maxyoucef6454
    @maxyoucef6454 Před 4 lety

    -quite-amazing-

  • @shivanisharma-kf2ti
    @shivanisharma-kf2ti Před 3 lety

    Thank you

  • @davidjohnston4240
    @davidjohnston4240 Před 4 lety

    If a cash machine was a curried function, you bank balance would never change and you could always get another 100 out.

  • @TheR971
    @TheR971 Před 4 lety +2

    5:02 I don't see the point.
    Yes, that was a FP pun.

  • @otesunki
    @otesunki Před 4 lety

    Help.
    Javascript does this.
    > let add = x=>y=>x+y
    x=>y=>x+y
    > let add2 = add(2)
    y=>x+y
    > add2
    y=>x+y
    > add2(4)
    6
    WHAT

  • @aylictal
    @aylictal Před 4 lety +1

    To show how much javascript has evolved in relation to the above and how similar it is to the arrow functions he was making:
    const add = x => y => x + y
    add(2)(3)
    The older way of doing it:
    var add = function(x){
    return function(y){
    return x+y
    }
    }
    add(2)(3)
    And finally, performing a spread operation to functional arguments (aka, an unknown amount of arguments):
    const add = (...args) => args.reduce((x, y) => x+y)
    add(2,3,4,5,6,7,8)

  • @Bestape
    @Bestape Před 4 lety

    Is there a practical difference other than maybe speed and brevity between this and getting the same result via nested functions with if statements?

    • @sdsdfdu4437
      @sdsdfdu4437 Před 4 lety +1

      Function composition and higher order functions

    • @Bestape
      @Bestape Před 4 lety

      @@sdsdfdu4437 Thanks! I think that's what I mean by brevity and speed but in reverse order. I'm assuming higher order is slower.

    • @sdsdfdu4437
      @sdsdfdu4437 Před 4 lety +2

      @@Bestape speed depends on the implementation, not the concept. The ghc (glaskow haskell compiler) is very efficient and can produce very fast and optimized programs.

  • @Submersed24
    @Submersed24 Před rokem

    I still don't fully understand why you would even want to use it in js besides for front end.

  • @musikSkool
    @musikSkool Před 4 lety

    Is there a real need for flow charts to aid in programming? Or does it not really help with the move to object oriented programming.

    • @xybersurfer
      @xybersurfer Před 4 lety

      one of the cool things about functional programming is that it's easier to capture in a flowchart than imperative programming

    • @musikSkool
      @musikSkool Před 4 lety

      @@xybersurfer I guess, but I could always keep track of what I was doing without one. I suppose if my higher-ups wanted one I could make one.

  • @greglee7708
    @greglee7708 Před 4 lety +1

    functional programming is the most interesting

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 Před 4 lety

      I don’t like pure functional-programming languages, but I like using functional constructs in procedural languages like Python which make them very handy.

  • @marynakosiv3750
    @marynakosiv3750 Před 4 lety

    thanks a lot!

  • @ChristiaanMeyer
    @ChristiaanMeyer Před 4 lety

    You say you don't need to give all of their inputs and then it doesn't work and then you continue to say it works without all the inputs even though it didn't?

  • @lasersimonjohnson
    @lasersimonjohnson Před 4 lety +5

    We spent years developing high level languages to make code easier to write and more readable/ easier to understand.
    This just dumps all over that 😂

  • @nwpgunner
    @nwpgunner Před 4 lety +1

    This haunted me in uni because professors didn't explain it as well

  • @hoagy_ytfc
    @hoagy_ytfc Před 4 lety +1

    Woah, "Haskell" rhymes with "Pascal"?!

    • @sdsdfdu4437
      @sdsdfdu4437 Před 4 lety +1

      Not really. 'el' and 'al' are different

    • @jeffspaulding9834
      @jeffspaulding9834 Před 4 lety +1

      Depends on the dialect. As a native Oklahoman, I say Haskell like "has skull" and Pascal with the same a sound as Haskell but the "al" sounds like "owl." I also put inflection on the "Has" in Haskell and the "al" in Pascal.

  • @vedant9173
    @vedant9173 Před 4 lety

    So is it similar to decorators one Python?

  • @jamesgrimwood1285
    @jamesgrimwood1285 Před 4 lety +1

    So now I know what one is, and even how to define one... But I don't know why they're used.

    • @cannaroe1213
      @cannaroe1213 Před 4 lety

      To be a computer scientists requires, more or less, one human unit of brain power/memory/time
      If the job requires less, it's vocabulary will be expanded until it does.

    • @DutchmanDavid
      @DutchmanDavid Před 4 lety

      Because it's mentally easier to follow
      Map (add 5) [1..10]
      Over
      Map f [1..10]
      Where f n = n + 5
      It does the same thing, but once you're used to the style, the first version will be preferred :)

    • @DutchmanDavid
      @DutchmanDavid Před 4 lety

      In other words: to create more functionality with as little as code needed.

  • @robertkelleher1850
    @robertkelleher1850 Před 2 lety

    This seems more a quirk of Haskell, than a fundamental computer science concept. The problem is universal (how to feed parameters to a function one at a time), but the solution doesn't feel universal.

  • @kebman
    @kebman Před 4 lety +1

    This video made me hungry... Couldn't find any Curry, so I went with Mexican. It's a bit spicy too, so hope that's acceptable!

  • @hayuseen6683
    @hayuseen6683 Před 4 lety

    add = \x -> (\y -> add x+y)
    Behold the function to add all

  • @arcanics1971
    @arcanics1971 Před 4 lety +3

    08:15 Ah, this explains why I am overdrawn!

  • @user-tv9gk8df1u
    @user-tv9gk8df1u Před 2 lety

    Does curry create side effects?

  • @John-pn4rt
    @John-pn4rt Před 4 lety

    does Graham Hutton only have blue gingham shirts?

  • @yash1152
    @yash1152 Před rokem

    4:51 map (add 1) [1..10]
    woah, awesome :)

  • @kmac499
    @kmac499 Před 4 lety +2

    Methinks the output from a curried function is highly deterministic and immutable.

    • @kmac499
      @kmac499 Před 4 lety

      @MichaelKingsfordGray I was thinking more of the Sunday am thunderbox visit after the Saturday night down the local star of Bengal. 😉😉

  • @elie3423
    @elie3423 Před 4 lety

    It's a design pattern btw

  • @pseudo_goose
    @pseudo_goose Před 4 lety

    The cuts to the black text on white background is giving me a headache...

  • @papikabron18
    @papikabron18 Před 4 lety

    Very interesting

  • @Janokins
    @Janokins Před 4 lety

    "Just take out the brackets" How do you do that in a more C-like language like C, C++, C#, Java, etc.?

    • @cannaroe1213
      @cannaroe1213 Před 4 lety

      You write three functions and run them one after the other. Currying is more of a syntax shorthand than a mathematical truth of the universe.

    • @jeffspaulding9834
      @jeffspaulding9834 Před 4 lety

      In C you use function pointers. The syntax is pretty horrible, but it can be done.
      But more to the point, you just don't do this in C, or any of those other languages you mentioned, because it's not idiomatic. Haskell programmers expect you to use currying because that's part of how you program Haskell, just like Scheme programmers expect you to use closures to accomplish more-or-less the same thing (more verbose syntax, but more flexible).
      Try currying in most C-family languages and all you cause is confusion, because if you're using currying in those languages then you're doing it wrong. The languages weren't intended for that paradigm, and other programmers will struggle to follow your logic.

  • @oliverarmitage1966
    @oliverarmitage1966 Před 4 lety +2

    was rly hoping this would be an april fools curry recipe

  • @VBKing2
    @VBKing2 Před 4 lety

    Brilliant

  • @narlzac85
    @narlzac85 Před 4 lety +2

    Started off strong, then once he got to the curried function itself, there was no explanation of why or where you would use this or even a demonstration of the function that was written.

  • @mzaman8660
    @mzaman8660 Před 4 lety

    This video would be better with a proper mic. Audio seems to be very poor.

  • @Wovi10
    @Wovi10 Před měsícem

    Please don't use Haskell for explanations like this. It might be an awesome language for some, but I think we can all agree that it is not very logical for people who aren't used to it. It makes an extra boundary for learning things.

  • @duncanboyes6478
    @duncanboyes6478 Před 3 lety

    It should be Moseying

  • @superscatboy
    @superscatboy Před 4 lety +4

    Haskell is bizarre to me, it seems like a solution to a problem that doesn't exist.

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 Před 4 lety +4

      Apropos a comment made by an ancient computer scientist about a different language, but perhaps applicable here: “it’s the language of the future, and always will be”.

    • @superscatboy
      @superscatboy Před 4 lety

      @@lawrencedoliveiro9104 I'm going to have to look that up, it's a great line.

  • @ekremdincel1505
    @ekremdincel1505 Před 4 lety

    4:48 *_magic_*

  • @zenawarrior3012
    @zenawarrior3012 Před 4 lety

    The whole world is using Zoom, along with many stories of it being insecure. Do you guys know if this app is safe or tips on how to safely use it? I was a little stunned when my children's school decided to use that as a form of communication.

    • @zenawarrior3012
      @zenawarrior3012 Před 4 lety

      @@analogueavenue Yes, well, that is why I'm asking if it's a school requirement. Was it the app, or user error? People don't tend to understand security settings.

    • @zenawarrior3012
      @zenawarrior3012 Před 4 lety

      @K.D.P. Ross I am sorry if the question offends you, but these guys are known in the US for their top notch cybersecurity. The only way to get a question through to them is through CZcams. It is relevant since zoom went from 3 million users to 200 million. This channel keeps up with current events as well as coding. They are the best.

  • @treelight1707
    @treelight1707 Před 4 lety +1

    So it get's renamed because you think it's easier to pronounce Curry than Shoenfinkel. You said that very casually, when it's kind of a pitiful justification for plagiarism. The author's name was just too hard for me to pronounce. It's his fault.

    • @Vulcapyro
      @Vulcapyro Před 4 lety

      Holy moly calm down, this is not anywhere even close to plagiarism. Curry and Schönfinkel were both highly involved in its development and Curry didn't even name it after himself, it was referred to that way by other people. Even in the case he had co-opted the name that isn't plagiarism lol.

  • @grainfrizz
    @grainfrizz Před 4 lety +1

    haskell dude

  • @raylee2292
    @raylee2292 Před 4 lety +1

    Hey ATM, give my card back

  • @haraldehrling8528
    @haraldehrling8528 Před 4 lety

    I have a question.
    When we use our pass code the code moves thought encryption and if the rubbish match the computer understand that we put the correct pass code but how does it understand the pattern lock we use on our smartphone?

    • @isaactfa
      @isaactfa Před 4 lety

      Basically, each vertex of the grid gets assigned a number from 0 to 8, zero being in the top left corner, 8 being in the bottom right. A pattern, then, is just a sequence of vertices in the order you need to hit them in. For example, when you swipe across the entire top row and then down the entire right column, creating a right angle shape, the pattern is 0-1-2-5-8. That is then turned into a byte array and stored as an unsalted SHA-1 hash and compared to whatever you put in.
      Essentially, it works the very much like a passcode.

    • @haraldehrling8528
      @haraldehrling8528 Před 4 lety

      @@isaactfa thanks I desperately wanted that answer. 😊 you just gained another subscriber.