1 00:00:01,690 --> 00:00:06,520 Heidi's rings at the heart and welcome to the next valley of this Mordy or high level functions and 2 00:00:06,520 --> 00:00:07,450 Landau's. 3 00:00:07,450 --> 00:00:11,480 Now this video is actually the continuation of the previous video. 4 00:00:11,560 --> 00:00:16,500 So make sure you have lost my previous video and then only continue with this video. 5 00:00:16,660 --> 00:00:23,020 So in this video we talk about the landers and High-Level level functions in deep detail so as to clear 6 00:00:23,020 --> 00:00:29,990 your concept with more clarity and also check out various ways to parse Lamda to the higher level functions 7 00:00:30,110 --> 00:00:32,160 that are present in case of Cartland. 8 00:00:33,020 --> 00:00:36,910 So first of all it does not exclude the lambdas in High-Level functions. 9 00:00:37,050 --> 00:00:41,860 So as seen in the previous video the lambda expression looks like this. 10 00:00:41,960 --> 00:00:44,090 That Gurli Blackard open and close. 11 00:00:44,240 --> 00:00:47,240 Within this we have the lambda expression. 12 00:00:47,390 --> 00:00:52,070 Now each lambda expression is actually the function. 13 00:00:52,130 --> 00:00:57,710 So x and y are promotors and after their dash and add. 14 00:00:57,750 --> 00:01:02,530 OPERATOR We have explicit VI which is actually the mentored body. 15 00:01:02,820 --> 00:01:08,240 So x and y are weaker and explicit phi is actually the Metford body. 16 00:01:08,270 --> 00:01:10,670 There are simply returns some value explicitly. 17 00:01:10,830 --> 00:01:13,960 We can assign this lambda expression to this. 18 00:01:13,980 --> 00:01:16,300 My lambda function very well. 19 00:01:16,320 --> 00:01:19,950 So this is a variable of this signature. 20 00:01:20,160 --> 00:01:25,280 So here we have colon followed by that type of variable that we have here. 21 00:01:25,440 --> 00:01:31,940 Now their type of variable of the land expression will have the signature is similar to the expression. 22 00:01:31,980 --> 00:01:34,730 So here X is indeed a value. 23 00:01:34,770 --> 00:01:41,970 VI is a integer value and then we have the return type as and that is explicit Y which is the method 24 00:01:41,970 --> 00:01:47,330 Bardy simply returns the integer value so that is why I have written here. 25 00:01:47,760 --> 00:01:55,710 So here we can see this is a variable name and here this is the method signature or the lambda signature 26 00:01:56,190 --> 00:01:56,690 that is. 27 00:01:56,730 --> 00:01:58,420 These are there to be reminders. 28 00:01:58,530 --> 00:02:02,730 X and Y and the Metford body returns in value. 29 00:02:02,800 --> 00:02:07,710 Doctors x and y returns the sum as integer value. 30 00:02:07,740 --> 00:02:10,860 Now then comes the calling of the High-Level function. 31 00:02:10,860 --> 00:02:12,780 Now what does a higher level function. 32 00:02:12,870 --> 00:02:20,820 The High-Level function actually contains simply accepts the lambda function as it did or it can also 33 00:02:20,880 --> 00:02:23,000 return the lambda function. 34 00:02:23,100 --> 00:02:29,040 So if a function follows either of these two that is accepting a lambda function or the expression or 35 00:02:29,130 --> 00:02:34,060 returning some lambda value then the method is known as the High-Level functions. 36 00:02:34,110 --> 00:02:39,750 So this is a Lambeck expression and this is the High-Level function that accepts my lambda function 37 00:02:40,100 --> 00:02:42,510 right or the expression. 38 00:02:42,540 --> 00:02:46,230 So here I have simply defined the function at two numbers. 39 00:02:46,240 --> 00:02:49,690 This is the act of numbered and then 3 comes to a. 40 00:02:49,710 --> 00:02:52,400 Which is the integer value it comes to be. 41 00:02:52,410 --> 00:02:54,360 Which is again the integer value. 42 00:02:54,360 --> 00:02:56,210 Then comes my lambda function. 43 00:02:56,220 --> 00:03:01,260 So here I have simply defined my function galloon the signature. 44 00:03:01,270 --> 00:03:05,810 Now if you compared Beco to an end you will find the same thing here. 45 00:03:05,880 --> 00:03:10,920 My function which is actually the variable name followed by the signature. 46 00:03:10,920 --> 00:03:14,370 So here it is a signature of this b variable. 47 00:03:14,520 --> 00:03:21,160 So here in N followed by N is actually the signature of this function. 48 00:03:21,360 --> 00:03:28,550 So this might function actually accepts two integer variables and then simply returns the endangered 49 00:03:28,620 --> 00:03:29,390 type. 50 00:03:29,790 --> 00:03:36,540 So inside the body of act two numbers we can simply write our code such as my function or B. 51 00:03:36,570 --> 00:03:43,710 Now here this my function is actually just one my func Derek simply passes to be witness of in B. 52 00:03:43,950 --> 00:03:49,140 So here a and b are these two variables that has a value of three and eight. 53 00:03:49,200 --> 00:03:52,390 So we are simply passing 3 and 8 as a parameter. 54 00:03:52,680 --> 00:04:02,370 So this is actually this X and this B is actually this vi so explicit y will be evaluated in place of 55 00:04:02,430 --> 00:04:04,030 my function and B. 56 00:04:04,200 --> 00:04:12,570 So instead of my function in B we can simply evaluate it as explicitly equal to LSV equal to the value 57 00:04:12,570 --> 00:04:14,260 that is to replace it. 58 00:04:14,300 --> 00:04:17,670 That simply returns 11 as desired that is. 59 00:04:17,670 --> 00:04:20,130 Finally we are getting live in as a value. 60 00:04:20,310 --> 00:04:22,680 So this Lebon will be stored inside. 61 00:04:22,710 --> 00:04:24,240 That is a variable. 62 00:04:24,600 --> 00:04:31,140 And finally we can simply playing the wizard and in the output console we will get live and as the output. 63 00:04:31,140 --> 00:04:34,680 So this is all about the Landau's and high level functions right. 64 00:04:34,740 --> 00:04:41,400 So just in place of my function and we simply replace it mentally by this explicit VI which is the Metford 65 00:04:41,400 --> 00:04:48,510 body and power the values as this one equal to 11 is the desired as simple as that. 66 00:04:48,540 --> 00:04:50,780 So he had inserted the intelligent ID. 67 00:04:50,820 --> 00:04:55,660 I was simply cleaned up my code so as to make things more simple and more clear. 68 00:04:57,090 --> 00:05:03,030 So now we're only left with the actual numbers method which is actually the High-Level function that 69 00:05:03,030 --> 00:05:07,160 takes the actual function as a land expression. 70 00:05:07,200 --> 00:05:10,780 Right and we are simply calling this function from here. 71 00:05:10,810 --> 00:05:16,860 Programs are actually numbers and simply passing them my lambda expression which we saw in the previous 72 00:05:16,950 --> 00:05:17,410 video. 73 00:05:17,430 --> 00:05:24,410 So no doubt till now now he had previously we were just printing the value that is inside the Metford 74 00:05:24,420 --> 00:05:26,400 body of this Lumba expression. 75 00:05:26,460 --> 00:05:28,710 We are just printing out the value. 76 00:05:28,710 --> 00:05:31,240 Now let us mortifies something such as. 77 00:05:31,260 --> 00:05:32,530 Instead of s. 78 00:05:32,590 --> 00:05:42,300 Let us see we have equal ma let's say X Y and then which is which is again of their type of an X and 79 00:05:42,300 --> 00:05:43,270 Y N. 80 00:05:43,650 --> 00:05:48,750 And then here let us use explicit WWAY. 81 00:05:49,220 --> 00:05:52,220 Now here as a lambda experiencing nature. 82 00:05:52,250 --> 00:05:53,710 We need to again change. 83 00:05:53,840 --> 00:05:56,650 So here we have two metres of x and y. 84 00:05:56,810 --> 00:06:04,970 So here we really use into coma and that is to beat on meters and then the return type is actually integer 85 00:06:05,120 --> 00:06:05,870 value. 86 00:06:05,870 --> 00:06:13,740 So instead of unit we can simply use an but I suppose if I say right here let's see a string value. 87 00:06:13,820 --> 00:06:20,600 So here I need to write here string as simple as that that you saw in the previous video as well. 88 00:06:20,600 --> 00:06:28,370 So here let us use and revert it back as well let's see explicit why doctors act with numbers. 89 00:06:28,430 --> 00:06:33,870 And now here I'm simply parsing my land as an expression do this add two numbers method. 90 00:06:33,950 --> 00:06:40,670 So I would simply modify my actual numbers metric so as to match the signature that we have defined 91 00:06:40,850 --> 00:06:42,370 here this signature. 92 00:06:42,620 --> 00:06:47,880 So simply copy this signature to control C and simply paste the signature here. 93 00:06:48,710 --> 00:06:51,520 So now we have to be in the middle of an end. 94 00:06:51,700 --> 00:06:57,110 There are simply returns the end value right now if you want it you can also make it flawed as well 95 00:06:57,350 --> 00:06:58,580 and change it every year. 96 00:06:58,580 --> 00:07:02,170 So as of now let's keep it in. 97 00:07:02,300 --> 00:07:05,780 And now here variable sum equal to a plus b. 98 00:07:05,950 --> 00:07:12,700 And then what we do is I will simply remove this chord here and now instead of this I'm having the method 99 00:07:12,700 --> 00:07:13,870 of action. 100 00:07:13,870 --> 00:07:20,580 So simply use action and then simply pause let's say a comma B. 101 00:07:20,680 --> 00:07:24,450 So we don't need to have this variable sum here as well. 102 00:07:24,790 --> 00:07:27,270 Just call action and B. 103 00:07:27,430 --> 00:07:30,370 So this will simply be evaluated as. 104 00:07:30,550 --> 00:07:32,070 Let's say the method body. 105 00:07:32,080 --> 00:07:37,090 Now the method body is explicit Why so explicit why. 106 00:07:37,450 --> 00:07:42,800 Now here the X is actually a and vi is actually be. 107 00:07:42,910 --> 00:07:46,230 So the value is actually 2 and 7. 108 00:07:46,300 --> 00:07:51,520 So we can simply use a class B equal to implies 2 plus 7. 109 00:07:51,520 --> 00:07:53,240 Now the result will be 9. 110 00:07:53,290 --> 00:07:57,620 So this action will again return the NBG value of 9. 111 00:07:58,030 --> 00:08:00,340 Right because the return type is here. 112 00:08:00,340 --> 00:08:05,100 So here I will simply define Val razored equal to action. 113 00:08:05,230 --> 00:08:07,000 Right and now are the end. 114 00:08:07,090 --> 00:08:10,550 But interline wizard. 115 00:08:10,840 --> 00:08:13,820 So let us show them the code and see what happens. 116 00:08:16,320 --> 00:08:18,870 So here we go nine in the output console. 117 00:08:18,900 --> 00:08:19,890 We are getting. 118 00:08:20,010 --> 00:08:20,710 Right. 119 00:08:20,790 --> 00:08:26,800 So in this video we just mortified our Lamda of what high level function. 120 00:08:26,820 --> 00:08:29,980 And also here we have that it don't type as in. 121 00:08:30,030 --> 00:08:35,190 Instead of unit and we're simply pointing out that Izard inside this act two numbers mattered. 122 00:08:35,250 --> 00:08:41,640 Now at the end of the previous video I told you instead of using this whole statement here very well 123 00:08:41,640 --> 00:08:47,180 my Lamda and so-so begin simply or copy this Landale expression from. 124 00:08:47,430 --> 00:08:53,950 And replace the variable name as with the land expression and simply command this line. 125 00:08:53,970 --> 00:08:56,170 So here we're simply parsing. 126 00:08:56,550 --> 00:08:58,350 And if you aren't you can also remove this. 127 00:08:58,490 --> 00:09:01,200 And and in signature here. 128 00:09:01,500 --> 00:09:06,950 X and Y are the parameters and X less y are actually limited body. 129 00:09:06,960 --> 00:09:13,350 And similarly here as really going to remove the end and also end this simplify as are called non-leaders 130 00:09:13,350 --> 00:09:15,620 render called. 131 00:09:15,640 --> 00:09:18,480 So here again we get nine in the output console. 132 00:09:18,670 --> 00:09:20,860 So our courts are working perfectly fine. 133 00:09:21,010 --> 00:09:25,360 So you can simply pass the lambda expressions directly. 134 00:09:25,390 --> 00:09:32,010 So this was one way and this is another way of calling the two numbers that has higher level functions. 135 00:09:32,110 --> 00:09:36,890 Now apart from these two ways there exist two more these Let me show you. 136 00:09:38,390 --> 00:09:43,610 So here I have two numbers simply passing my lambda function as a variable. 137 00:09:43,640 --> 00:09:48,170 Now apart from this you can also passed the lambda expression very. 138 00:09:48,250 --> 00:09:52,810 That is simply using x y followed by explicit VI here. 139 00:09:52,950 --> 00:09:55,470 Actually right now similar to this. 140 00:09:55,490 --> 00:09:57,510 We have one more alternative. 141 00:09:57,560 --> 00:10:04,910 The is simply use Act Two numbers three and it then simply close the bracket. 142 00:10:04,910 --> 00:10:12,690 Now if you look at this statement you will find the lambda expression is actually present right after 143 00:10:12,690 --> 00:10:15,300 the end of the last parameter that is 8. 144 00:10:15,480 --> 00:10:18,750 It is actually looking like a third body the two numbers. 145 00:10:18,780 --> 00:10:22,900 And here as a metric body I have the lambda expression. 146 00:10:23,040 --> 00:10:25,830 So is sort of losing the Blackard here. 147 00:10:25,840 --> 00:10:31,540 We're simply closing down the Blackard here and then defining the lambda expression. 148 00:10:31,560 --> 00:10:36,550 So these three are actually seems so all of these three could really give the same output. 149 00:10:36,630 --> 00:10:41,990 Let me show you the code in action inside the intelligence the. 150 00:10:42,010 --> 00:10:47,950 So here again let me copy discord and Peyster it again later make I in the line. 151 00:10:48,130 --> 00:10:55,430 And now here instead of closing the Blackard here I simply use the Blackard here by removing the comma. 152 00:10:55,530 --> 00:11:00,960 And now if you notice authored two and seven I'm simply having the lambda expression that appears to 153 00:11:00,960 --> 00:11:03,250 be the mentor body right. 154 00:11:04,550 --> 00:11:06,870 So it doesn't d'accord LHC what happens. 155 00:11:08,560 --> 00:11:11,730 So here again we get the same output as nine. 156 00:11:11,770 --> 00:11:13,630 So it makes no difference. 157 00:11:13,630 --> 00:11:17,720 So all these three lines of code words are working perfectly fine. 158 00:11:17,830 --> 00:11:25,360 You can use the variable name lambda expression directly or you can use this way of defining the expression 159 00:11:25,750 --> 00:11:28,020 outside the method body like this. 160 00:11:28,060 --> 00:11:28,600 Right. 161 00:11:29,490 --> 00:11:31,770 So this is all about this video. 162 00:11:31,770 --> 00:11:37,590 Now we take our discussion to the next level in the next video and we'll talk more about the lambda 163 00:11:37,590 --> 00:11:40,600 expression and higher level functions in case of Cartland. 164 00:11:40,770 --> 00:11:43,980 Now remember these two concepts are very very important. 165 00:11:44,040 --> 00:11:44,580 Right. 166 00:11:44,610 --> 00:11:48,380 So make sure you watch all these videos in this Marty. 167 00:11:48,720 --> 00:11:50,330 Thanks for watching and have a good day. 168 00:11:50,340 --> 00:11:51,100 Thank you.