Curried Functions - Computerphile

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 298

  • @cxxvx
    @cxxvx 3 роки тому +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 4 роки тому +43

    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 4 роки тому +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 4 роки тому +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 2 роки тому

      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 3 роки тому +5

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

  • @PaulBunkey
    @PaulBunkey 4 роки тому +93

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

    • @rogerbosman2126
      @rogerbosman2126 4 роки тому +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 4 роки тому +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 4 роки тому +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 4 роки тому +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)

  • @Jopie65
    @Jopie65 4 роки тому +128

    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 4 роки тому +41

      This makes more sense than the entire video

    • @aymanayman9000
      @aymanayman9000 4 роки тому

      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 4 роки тому +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 4 роки тому +6

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

    • @user255
      @user255 4 роки тому +6

      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)

  • @letMeSayThatInIrish
    @letMeSayThatInIrish 4 роки тому +61

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

  • @clairearan505
    @clairearan505 6 місяців тому

    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!

  • @myguitardidyermom212
    @myguitardidyermom212 2 роки тому +1

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

  • @richardjames712
    @richardjames712 4 роки тому +60

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

    • @Pacvalham
      @Pacvalham 4 роки тому +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 4 роки тому +2

      This makes javascripting easier

  • @jorgejarai
    @jorgejarai 4 роки тому +65

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

    • @QuantumFluxable
      @QuantumFluxable 4 роки тому

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

    • @Twisted_Code
      @Twisted_Code 4 роки тому

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

    • @QuantumFluxable
      @QuantumFluxable 4 роки тому

      @@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 4 роки тому

      @@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 4 роки тому

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

  • @agivney
    @agivney 4 роки тому +4

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

  • @Marc-tm4xh
    @Marc-tm4xh 4 роки тому +44

    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 4 роки тому +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 4 роки тому +14

      You mean partial evaluation?

    • @monnef
      @monnef 4 роки тому +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 4 роки тому +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 4 роки тому

      It is called partial application function

  • @yommish
    @yommish Рік тому

    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.

  • @skyburngames7381
    @skyburngames7381 3 роки тому

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

  • @IIARROWS
    @IIARROWS 4 роки тому +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 4 роки тому +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.

  • @omgomgomgd
    @omgomgomgd 4 роки тому +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 4 роки тому +1

      That's why i'm watching this video lol

    • @matsonnerby
      @matsonnerby 4 роки тому +3

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

    • @superscatboy
      @superscatboy 4 роки тому +4

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

    • @3dlabs99
      @3dlabs99 4 роки тому

      Yeah this april 1st joke is BOOORING

  • @nO_d3N1AL
    @nO_d3N1AL 4 роки тому +10

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

  • @haos4574
    @haos4574 2 роки тому +1

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

  • @SakataSamig
    @SakataSamig 4 роки тому +6

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

  • @zewdiherring9528
    @zewdiherring9528 2 роки тому +1

    Cash machine example made it all come together!

  • @frognik79
    @frognik79 4 роки тому +112

    Take a shot every time he says "function".

    • @jakegore759
      @jakegore759 4 роки тому +10

      did this, am currently having my stomach pumped

    • @BicyclesMayUseFullLane
      @BicyclesMayUseFullLane 4 роки тому +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 4 роки тому +2

      chjAlleNge aCCcepted

    • @RussellRiker
      @RussellRiker 4 роки тому +1

      1 shot, 2 shots, 3 shots, floor.

    • @yyny0
      @yyny0 4 роки тому

      those functional programmers and their functions...

  • @danielchequer5842
    @danielchequer5842 4 роки тому +2

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

  • @nilp0inter2
    @nilp0inter2 4 роки тому +1

    The best functional programming teacher out there!

  • @xichaopeng7904
    @xichaopeng7904 4 роки тому

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

  • @washingtonlgois
    @washingtonlgois 3 роки тому

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

  • @victoriakee61
    @victoriakee61 2 роки тому

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

  • @jimgolab536
    @jimgolab536 4 роки тому

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

  • @DanieleFilaretti
    @DanieleFilaretti Рік тому

    loved the cash machine example! great video!

  • @nihilistbookclub5370
    @nihilistbookclub5370 4 роки тому +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

  • @HasanBasri-vf2kg
    @HasanBasri-vf2kg 2 роки тому

    Thank you very much for clear explanations to understand the topic

  • @valtersanches3124
    @valtersanches3124 Рік тому +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

  • @ahmadshwaiki5744
    @ahmadshwaiki5744 6 місяців тому

    simple yet very helpful indeed, thank you

  • @moritzschmidt6791
    @moritzschmidt6791 4 роки тому

    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.

  • @inversnone
    @inversnone 4 роки тому +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.

  • @albertofabbri1543
    @albertofabbri1543 3 роки тому +1

    Thank you very much for the very clear explanation!

  • @savaged
    @savaged Рік тому

    Excellent explanation of currying and even better comic timing!!

  • @mr7clay
    @mr7clay 4 роки тому +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 4 роки тому +1

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

  • @indonesiamendaurulang
    @indonesiamendaurulang 3 роки тому

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

  • @0x6e95
    @0x6e95 4 роки тому +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 4 роки тому +17

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

  • @ReddSpark
    @ReddSpark 3 роки тому +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.

  • @the_niss
    @the_niss 4 роки тому +1

    The cashmachine is a very good example

  • @huycao8521
    @huycao8521 3 роки тому +1

    thank you for the great content :D

  • @Bestape
    @Bestape 4 роки тому

    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 4 роки тому +1

      Function composition and higher order functions

    • @Bestape
      @Bestape 4 роки тому

      @@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 4 роки тому +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.

  • @2eath
    @2eath 4 роки тому

    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?

  • @BinaryReader
    @BinaryReader 4 роки тому +36

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

    • @Bayo106
      @Bayo106 4 роки тому

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

    • @BinaryReader
      @BinaryReader 4 роки тому +1

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

    • @technicalfool
      @technicalfool 4 роки тому +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- 4 роки тому

      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 4 роки тому

      @@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.

  • @JNCressey
    @JNCressey 4 роки тому +1

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

    • @DutchmanDavid
      @DutchmanDavid 4 роки тому +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.

  • @immabreakaleg
    @immabreakaleg 3 роки тому +1

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

  • @musikSkool
    @musikSkool 4 роки тому

    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 4 роки тому

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

    • @musikSkool
      @musikSkool 4 роки тому

      @@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.

  • @nerdophile6945
    @nerdophile6945 4 роки тому +22

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

  • @theQuickRundown
    @theQuickRundown 2 роки тому

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

  • @TheR971
    @TheR971 4 роки тому +2

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

  • @xybersurfer
    @xybersurfer 4 роки тому

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

  • @arcanics1971
    @arcanics1971 4 роки тому +3

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

  • @georganatoly6646
    @georganatoly6646 4 роки тому +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.

  • @Janokins
    @Janokins 4 роки тому

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

    • @cannaroe1213
      @cannaroe1213 4 роки тому

      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 4 роки тому

      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.

  • @roberthunter5059
    @roberthunter5059 4 роки тому +6

    I've always wondered how HP calculators were programmed.

    • @Bin216
      @Bin216 4 роки тому

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

  • @kebman
    @kebman 4 роки тому +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!

  • @nwpgunner
    @nwpgunner 4 роки тому +1

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

  • @kenziephillips
    @kenziephillips 4 роки тому +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 4 роки тому

      @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 4 роки тому +8

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

    • @jpisello
      @jpisello 4 роки тому +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 4 роки тому +3

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

  • @gregslu
    @gregslu 4 роки тому +1

    functional programming is the most interesting

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 4 роки тому

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

  • @AaronTheGerman
    @AaronTheGerman 4 роки тому

    Why use inc if you can have the succ?

  • @John-pn4rt
    @John-pn4rt 4 роки тому

    does Graham Hutton only have blue gingham shirts?

  • @davidjohnston4240
    @davidjohnston4240 4 роки тому

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

  • @yash1152
    @yash1152 Рік тому

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

  • @edgbaston149
    @edgbaston149 2 роки тому

    Thank you so much

  • @franzweitkamp
    @franzweitkamp 4 роки тому +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.

  • @vedant9173
    @vedant9173 4 роки тому

    So is it similar to decorators one Python?

  • @maxyoucef6454
    @maxyoucef6454 4 роки тому

    -quite-amazing-

  • @oliverarmitage1966
    @oliverarmitage1966 4 роки тому +2

    was rly hoping this would be an april fools curry recipe

  • @jamesgrimwood1285
    @jamesgrimwood1285 4 роки тому +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 4 роки тому

      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 4 роки тому

      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 4 роки тому

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

  • @ekrem_dincel
    @ekrem_dincel 4 роки тому

    4:48 *_magic_*

  • @benjaminbrady2385
    @benjaminbrady2385 4 роки тому

    8:42 Can we please change our bank notes to look like that

  • @hayuseen6683
    @hayuseen6683 4 роки тому

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

  • @shivanisharma-kf2ti
    @shivanisharma-kf2ti 3 роки тому

    Thank you

  • @kmac499
    @kmac499 4 роки тому +2

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

    • @kmac499
      @kmac499 4 роки тому

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

  • @БорисЮринов-ъ8ъ
    @БорисЮринов-ъ8ъ 2 роки тому

    Does curry create side effects?

  • @marynakosiv3750
    @marynakosiv3750 4 роки тому

    thanks a lot!

  • @hoagy_ytfc
    @hoagy_ytfc 4 роки тому +1

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

    • @sdsdfdu4437
      @sdsdfdu4437 4 роки тому +1

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

    • @jeffspaulding9834
      @jeffspaulding9834 4 роки тому +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.

  • @guanche011
    @guanche011 4 роки тому +12

    Those Haskell error messages need some work :)

  • @pseudo_goose
    @pseudo_goose 4 роки тому

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

  • @elie3423
    @elie3423 4 роки тому

    It's a design pattern btw

  • @ekrem_dincel
    @ekrem_dincel 4 роки тому +3

    8:43 lol comoney

  • @Submersed24
    @Submersed24 2 роки тому

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

  • @ekrem_dincel
    @ekrem_dincel 4 роки тому +2

    4:30 This why we shouldn't take photos by toaster

  • @sharpfang
    @sharpfang 4 роки тому

    Let's take a finite state machine and hammer it into a functional language digestible format.

  • @user-vn7ce5ig1z
    @user-vn7ce5ig1z 4 роки тому

    0:42 - I thought he said Pascal. I was excited for a moment there. :-|

    • @nodroGnotlrahC
      @nodroGnotlrahC 4 роки тому +2

      I thought he said Schoenberg was a "mathematician and magician".

    • @jeffspaulding9834
      @jeffspaulding9834 4 роки тому

      Hrm, I just checked and apparently Pascal does have function pointers. So you could most likely do currying in Pascal.
      Not sure why you'd want to, but that's never stopped anyone before.

  • @robertkelleher1850
    @robertkelleher1850 2 роки тому

    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.

  • @papikabron18
    @papikabron18 4 роки тому

    Very interesting

  • @VBKing2
    @VBKing2 4 роки тому

    Brilliant

  • @otesunki
    @otesunki 4 роки тому

    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

  • @haraldehrling8528
    @haraldehrling8528 4 роки тому

    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 4 роки тому

      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 4 роки тому

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

  • @PurelyDef
    @PurelyDef 2 роки тому

    0:33 shows a visual of what a basic function is, something you assume people know
    2:22 demonstrates taking in multiple arguments and passing them into a function collectively
    then when it comes time to visualize the actual concept you're teaching, nothing is provided. The idea of a function magically waiting for the next input like the cash machine example fails to explain the logic of what's causing it to behave that way from the standpoint of having functions inside of functions whhere each is described as input --> [function] --> output.
    All the while, explaining the concept using a programming language that statistically used by less than 1% of all programmers rather than choosing to do it in a language that is statistically likely to reach the most viewers, particularly those who want to learn new concepts.
    I'll never understand how educators are so absurdly bad at educating

  • @zenawarrior3012
    @zenawarrior3012 4 роки тому

    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 4 роки тому

      @@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 4 роки тому

      @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 UA-cam. 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.

  • @ChristiaanMeyer
    @ChristiaanMeyer 4 роки тому

    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?

  • @narlzac85
    @narlzac85 4 роки тому +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.

  • @dasten123
    @dasten123 4 роки тому +1

    Wanna write super ugly and unreadable code? Write curried functions!

  • @raylee2292
    @raylee2292 4 роки тому +1

    Hey ATM, give my card back

  • @aylictal
    @aylictal 4 роки тому +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)