Curried Functions - Computerphile

  Рет қаралды 101,437

Computerphile

Computerphile

Күн бұрын

It's all about the input. You can't always give all a function's inputs at the same time. Professor Graham Hutton explains about curried functions.
/ computerphile
/ computer_phile
This video was filmed by Graham Hutton and edited by Sean Riley.
Computer Science at the University of Nottingham: bit.ly/nottscomputer
Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

Пікірлер: 296
@jonathandannel8712
@jonathandannel8712 3 жыл бұрын
"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.
@clairearan505
@clairearan505 13 күн бұрын
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!
@kevinbee4617
@kevinbee4617 4 жыл бұрын
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 3 жыл бұрын
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 3 жыл бұрын
@@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.
@letMeSayThatInIrish
@letMeSayThatInIrish 4 жыл бұрын
I will call them "Schönfinkeled functions' from now on.
@thoperSought
@thoperSought 2 жыл бұрын
0:10 _"... which sound a bit spicy, but are actually very useful."_ excellent delivery, Professor Hutton.
@Jopie65
@Jopie65 4 жыл бұрын
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 жыл бұрын
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 жыл бұрын
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 жыл бұрын
This example would have been the perfect ending to the video, thank you for posting it :)
@user255
@user255 4 жыл бұрын
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)
@PaulBunkey
@PaulBunkey 4 жыл бұрын
8:57 *Looks at perfectly understandable expression* "Let's make it clear what's going on", *writes Haskel notation gibberish*
@rogerbosman2126
@rogerbosman2126 4 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@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 жыл бұрын
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)
@jorgejarai
@jorgejarai 4 жыл бұрын
I demand the new world currency must be the Brailsford (with the generic currency ¤ as its symbol)
@QuantumFluxable
@QuantumFluxable 3 жыл бұрын
that's no generic currency, it's dwarf bucks!
@Twisted_Code
@Twisted_Code 3 жыл бұрын
okay I must be missing context here. Care to explain?
@QuantumFluxable
@QuantumFluxable 3 жыл бұрын
@@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 3 жыл бұрын
@@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 3 жыл бұрын
I'm still not following how this all relates to the video? Are you referring to the cash machine part of the video?
@richardjames712
@richardjames712 4 жыл бұрын
First time I've actually understood currying - or at least, I'm starting to understand it now. Many thanks.
@Pacvalham
@Pacvalham 4 жыл бұрын
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 жыл бұрын
This makes javascripting easier
@omgomgomgd
@omgomgomgd 4 жыл бұрын
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 жыл бұрын
That's why i'm watching this video lol
@matsonnerby
@matsonnerby 4 жыл бұрын
Exactly. I was hoping for a 1 April joke. Noop
@superscatboy
@superscatboy 4 жыл бұрын
There's no way Haskell can be a real thing.
@3dlabs99
@3dlabs99 4 жыл бұрын
Yeah this april 1st joke is BOOORING
@Marc-tm4xh
@Marc-tm4xh 4 жыл бұрын
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 жыл бұрын
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 жыл бұрын
You mean partial evaluation?
@monnef
@monnef 4 жыл бұрын
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 жыл бұрын
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
@IIARROWS
@IIARROWS 4 жыл бұрын
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 жыл бұрын
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 4 жыл бұрын
Great explanation. I like how you explain how to apply this to the map function, this makes the concept clear.
@frognik79
@frognik79 4 жыл бұрын
Take a shot every time he says "function".
@jakegore759
@jakegore759 4 жыл бұрын
did this, am currently having my stomach pumped
@BicyclesMayUseFullLane
@BicyclesMayUseFullLane 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 жыл бұрын
chjAlleNge aCCcepted
@RussellRiker
@RussellRiker 4 жыл бұрын
1 shot, 2 shots, 3 shots, floor.
@yyny0
@yyny0 4 жыл бұрын
those functional programmers and their functions...
@myguitardidyermom212
@myguitardidyermom212 2 жыл бұрын
Prof. Hutton has a real gift for making complicated concepts easy to understand for
@skyburngames7381
@skyburngames7381 3 жыл бұрын
Very clear explanation of curried functions, higher-order functions, and lambda expressions, worth the 10 min watch!
@xichaopeng7904
@xichaopeng7904 4 жыл бұрын
Thanks for having Mr. Fincher as a guest I love his work
@jimgolab536
@jimgolab536 3 жыл бұрын
This is very clear. The motivating cm example at the end was extremely helpful. Thanks!
@nO_d3N1AL
@nO_d3N1AL 4 жыл бұрын
Excellent video - should be on the tutorial page for Haskell. Well-explained, understandable but not overly simplified or verbose.
@SakataSamig
@SakataSamig 4 жыл бұрын
Just what I needed. Been a bit confused witn curried function or high order function.
@inversnone
@inversnone 4 жыл бұрын
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.
@haos4574
@haos4574 2 жыл бұрын
You made me understand at exactly 6:20 - 6:30, it's so clever! Thank you!
@yommish
@yommish 6 ай бұрын
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.
@albertofabbri1543
@albertofabbri1543 3 жыл бұрын
Thank you very much for the very clear explanation!
@indonesiamendaurulang
@indonesiamendaurulang 2 жыл бұрын
this is really a very easy to understand explaination, much thanks !!
@HasanBasri-vf2kg
@HasanBasri-vf2kg 2 жыл бұрын
Thank you very much for clear explanations to understand the topic
@nilp0inter2
@nilp0inter2 4 жыл бұрын
The best functional programming teacher out there!
@nihilistbookclub5370
@nihilistbookclub5370 4 жыл бұрын
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
@danielchequer5842
@danielchequer5842 4 жыл бұрын
This video actually made me hungry for hearing curried so many times
@DanieleFilaretti
@DanieleFilaretti Жыл бұрын
loved the cash machine example! great video!
@victoriakee61
@victoriakee61 Жыл бұрын
Thank you, thank you, thank you for breaking it down with the cash machine problem.
@valtersanches3124
@valtersanches3124 7 ай бұрын
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
@washingtonlgois
@washingtonlgois 2 жыл бұрын
Wow, the example of the cash machine made so easier to understand this! Thank you so much!
@zewdiherring9528
@zewdiherring9528 2 жыл бұрын
Cash machine example made it all come together!
@savaged
@savaged Жыл бұрын
Excellent explanation of currying and even better comic timing!!
@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.
@mr7clay
@mr7clay 4 жыл бұрын
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 жыл бұрын
No, but it does do inlining when possible, which is even more efficient than memoizing.
@edgbaston149
@edgbaston149 2 жыл бұрын
Thank you so much
@0x6e95
@0x6e95 4 жыл бұрын
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.
@huycao8521
@huycao8521 3 жыл бұрын
thank you for the great content :D
@JNCressey
@JNCressey 4 жыл бұрын
why does it give an error instead of maybe a little description saying that it's returned a function?
@DutchmanDavid
@DutchmanDavid 4 жыл бұрын
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.
@maxyoucef6454
@maxyoucef6454 4 жыл бұрын
-quite-amazing-
@ntzst1018
@ntzst1018 4 жыл бұрын
Study with zoom day 10:🤦 Computerphile new video:💃
@shivanisharma-kf2ti
@shivanisharma-kf2ti 3 жыл бұрын
Thank you
@the_niss
@the_niss 4 жыл бұрын
The cashmachine is a very good example
@nerdophile6945
@nerdophile6945 4 жыл бұрын
Curried function, sounds a bit spicy. I see what you did there!!
@marynakosiv3750
@marynakosiv3750 4 жыл бұрын
thanks a lot!
@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?
@nwpgunner
@nwpgunner 4 жыл бұрын
This haunted me in uni because professors didn't explain it as well
@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 жыл бұрын
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 жыл бұрын
@@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.
@xybersurfer
@xybersurfer 4 жыл бұрын
i would say that Schönfinkel's contribution is the most important one to lambda calculus
@VBKing2
@VBKing2 4 жыл бұрын
Brilliant
@firstnamelastname2805
@firstnamelastname2805 4 жыл бұрын
Thanks for trying, but this video makes curried functions seem unnecessary and confusing...🤔
@jpisello
@jpisello 4 жыл бұрын
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 жыл бұрын
Exactly what I was thinking. He explained what they are clearly enough, but I can never see where I'd care.
@roberthunter5059
@roberthunter5059 4 жыл бұрын
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...
@papikabron18
@papikabron18 4 жыл бұрын
Very interesting
@arcanics1971
@arcanics1971 4 жыл бұрын
08:15 Ah, this explains why I am overdrawn!
@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.
@John-pn4rt
@John-pn4rt 4 жыл бұрын
does Graham Hutton only have blue gingham shirts?
@theQuickRundown
@theQuickRundown Жыл бұрын
"Schönfinkeled functions" sounds so fancy, should rename it :D
@guanche011
@guanche011 4 жыл бұрын
Those Haskell error messages need some work :)
@immabreakaleg
@immabreakaleg 3 жыл бұрын
concept in python: ``` def curried_f(x): return lambda y: x + y print(curried_f(2)(3)) ```
@AaronTheGerman
@AaronTheGerman 4 жыл бұрын
Why use inc if you can have the succ?
@vedant9173
@vedant9173 4 жыл бұрын
So is it similar to decorators one Python?
@Tweakimp
@Tweakimp 4 жыл бұрын
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.
@BinaryReader
@BinaryReader 4 жыл бұрын
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 жыл бұрын
@Sydney Bean JavaScript perhaps? const f = x => y => x + y ?
@technicalfool
@technicalfool 4 жыл бұрын
@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.
@ReddSpark
@ReddSpark 3 жыл бұрын
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.
@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.
@kenziephillips
@kenziephillips 4 жыл бұрын
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.
@oliverarmitage1966
@oliverarmitage1966 4 жыл бұрын
was rly hoping this would be an april fools curry recipe
@TheR971
@TheR971 4 жыл бұрын
5:02 I don't see the point. Yes, that was a FP pun.
@kebman
@kebman 4 жыл бұрын
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!
@jamesgrimwood1285
@jamesgrimwood1285 4 жыл бұрын
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.
@greglee7708
@greglee7708 4 жыл бұрын
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.
@yash1152
@yash1152 Жыл бұрын
4:51 map (add 1) [1..10] woah, awesome :)
@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.
@pseudo_goose
@pseudo_goose 4 жыл бұрын
The cuts to the black text on white background is giving me a headache...
@user-tv9gk8df1u
@user-tv9gk8df1u 2 жыл бұрын
Does curry create side effects?
@ekremdincel1505
@ekremdincel1505 4 жыл бұрын
4:48 *_magic_*
@BicyclesMayUseFullLane
@BicyclesMayUseFullLane 4 жыл бұрын
Higher-order function is fun.
@georganatoly6646
@georganatoly6646 4 жыл бұрын
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.
@louisconstant8214
@louisconstant8214 Жыл бұрын
Also: monads.
@Submersed24
@Submersed24 Жыл бұрын
I still don't fully understand why you would even want to use it in js besides for front end.
@hayuseen6683
@hayuseen6683 4 жыл бұрын
add = \x -> (\y -> add x+y) Behold the function to add all
@aylictal
@aylictal 3 жыл бұрын
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)
@lasersimonjohnson
@lasersimonjohnson 4 жыл бұрын
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 😂
@igoralmeida9136
@igoralmeida9136 4 жыл бұрын
why?
@lawrencedoliveiro9104
@lawrencedoliveiro9104 4 жыл бұрын
You sound like a Java programmer.
@otesunki
@otesunki 3 жыл бұрын
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
@sharpfang
@sharpfang 4 жыл бұрын
Let's take a finite state machine and hammer it into a functional language digestible format.
@elie3423
@elie3423 4 жыл бұрын
It's a design pattern btw
@kmac499
@kmac499 4 жыл бұрын
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. 😉😉
@grainfrizz
@grainfrizz 4 жыл бұрын
haskell dude
@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.
@hoagy_ytfc
@hoagy_ytfc 4 жыл бұрын
Woah, "Haskell" rhymes with "Pascal"?!
@sdsdfdu4437
@sdsdfdu4437 4 жыл бұрын
Not really. 'el' and 'al' are different
@jeffspaulding9834
@jeffspaulding9834 4 жыл бұрын
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.
@ekremdincel1505
@ekremdincel1505 4 жыл бұрын
8:43 lol comoney
@narlzac85
@narlzac85 4 жыл бұрын
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.
@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.
@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 KZbin. 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.
@user-vn7ce5ig1z
@user-vn7ce5ig1z 4 жыл бұрын
0:42 - I thought he said Pascal. I was excited for a moment there. :-|
@nodroGnotlrahC
@nodroGnotlrahC 4 жыл бұрын
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.
@ChristiaanMeyer
@ChristiaanMeyer 3 жыл бұрын
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?
@mzaman8660
@mzaman8660 4 жыл бұрын
This video would be better with a proper mic. Audio seems to be very poor.
@gatoradeee
@gatoradeee 2 жыл бұрын
SPICY
@EpicWink
@EpicWink 4 жыл бұрын
Something something closures something
@kebman
@kebman 4 жыл бұрын
Looks a bit like anonymous functions in JavaScript...
What is a Monad? - Computerphile
21:50
Computerphile
Рет қаралды 592 М.
Lambda Calculus - Computerphile
12:40
Computerphile
Рет қаралды 1 МЛН
Just try to use a cool gadget 😍
00:33
123 GO! SHORTS
Рет қаралды 26 МЛН
Каха инструкция по шашлыку
01:00
К-Media
Рет қаралды 8 МЛН
100❤️
00:20
Nonomen ノノメン
Рет қаралды 67 МЛН
Your code can be beautiful AND fast (Higher order functions)
8:13
Tail Recursion Explained - Computerphile
16:05
Computerphile
Рет қаралды 169 М.
Essentials: Functional Programming's Y Combinator - Computerphile
13:26
Functional Parsing - Computerphile
22:46
Computerphile
Рет қаралды 133 М.
RegEx Roman Numerals - Computerphile
17:14
Computerphile
Рет қаралды 85 М.
Regular Expressions - Computerphile
17:19
Computerphile
Рет қаралды 239 М.
Dear Functional Bros
16:50
CodeAesthetic
Рет қаралды 461 М.
Programming Loops vs Recursion - Computerphile
12:32
Computerphile
Рет қаралды 1,4 МЛН
Semantics: Lambda Calculus and Types
19:08
TrevTutor
Рет қаралды 9 М.
Functional Programming & Haskell - Computerphile
9:19
Computerphile
Рет қаралды 658 М.
Just try to use a cool gadget 😍
00:33
123 GO! SHORTS
Рет қаралды 26 МЛН