20 videos
111 minutes
Well friends started with an exercise in haskell then let's do an exercise that combines intentional lists with duos and here I have good exercise, we have a right triangle as we know for this is 90 degrees, this is the hypotenuse and we hicks and we will do the exercise as follows, we will try to find that triangle has all sides less than ten, I'll put all the conditions
Its sides are less than ten than the sum of its sides that a + b + c is equal to twenty-four, these are the data we have and of course good if it is a right angle, because this is a right triangle because we know of course that squared plus b squared equals c squared, this is the premise that meet all the triangles. These are the data we have, how we convert this in haskell?
well let's try to do, what I will do here is to minimize this to see if we can see to see if it is hard to see, and that is reached to see all of a view I hope that this will serve you and hope it is good, I'll clean the screen to have more input field. perfect start do the following, we will establish our role to let you know of the previous videos I'll put triangles here
and this function will be equal to the following, well this is what we will do is. Put the brackets, I put the separator here and say here's what we will return we will have as we know all the three values of the sides a b c and on this side we will establish the following conclusions as we know that all sides are less than ten, then we will say that we will add all the data from the list ranging from 1 to 10
we know how to make one point about ten these lists at the same time we say that b is all the data ranging from 1 to 10 list and c perfect and just as we put him from 1 to 10. While this is swallowed well and if we capture triangles we get all possible combinations until now, we'll keep giving it more shape, well what we see of this is that a is less than b
and b is less than c, then let's do something, let's say that c is from 1 to 10 and b go from one to c and b of each let's put that, well, if it swallows we give equal and result will be the same but now when we go after adding conditions we are already filtering and we are doing all this to be different, then we will put most other conditions, our comma separated conditions
let's put that squared plus b squared equals double equals c squared, and this is because all those triangles that have so far are triangles in any way and how we want to put right triangles have this condition again, we swallows and now we have fewer triangles of all possible we were only two, but also left us two because we have made these conditions
if I had not put these conditions if not all have put up ten there would be different results and now we want to add twenty-four you'll add here the condition that a + b + c is equal to twenty-four, swallows, show and there we have (6, 8, 10) is the result for this exercise coméntame good if this exercise seemed very complicated if you thought you simple, if you want to do such
if you want to start with more basic to go forward, coméntame you seem to know what level of haskell is the one you want to receive says all the exercises that you have simpler to take them into account and to solve them in future videos, I hope you liked, you can give the like so that more people share it, fellow students know about this playlist of videos and easily learn haskell
Share and subscribe, see you in more videos, greetings.
About the Author
Biography: Analyst-Programmer in different languages. Tutor PREMIUM platforms recognized worldwide as CodigoFacilito. Editor Cristalab articles. My YouTube Channel is sponsored by the ANAYA and LaTostadora publisher. I like to explain in detail and give several examples for the avoidance of doubt.