20 videos
111 minutes
Hello world this are, I welcome the good course of Haskell and we'll see this time as becoming combine different lists duplas lists with a function that is the ZIP, if this sounds a little strange calm because now we will see an example and this you will be much clearer, well let's imagine we have two lists, for example I have here a list that is 'names' and here we will have 'john'
alberto, 'manolo' and 'luis' for example. And now we have another list that is 'heights' and here we will have 1.78, 1.98, 1.67 and 1.80. Well I have a list with 4 names and a list with 4 good numerical data that I have understood that they are statures, now what if I want to combine these two lists form I that mix the elements of the other and that the first element of the list of 'names' matches the first element
from the list of 'heights' and so on are all so intertwined, well do the following, we zip the name of the list namespace and the name of the second 'heights' and mixed all joining the first element with the first height, the second name to the second height, here it says 'John', 1.78; 'Alberto', 1.98; 'Manolo', 1.67; 'Luis', 1.8; so that the mixture combining Duplas
the same number of positions of each of the lists, well this is very interesting may have many utilities in this case was a simple example, as fit your code, but hey there you have it, another thing that was going to tell them is that if for example do not agree on the number of elements for example imagine that here in 'stature' we have much more data, I will put more random data and now as one of the lists is much longer
the other, now if trying to make that mixture would happen, well, let's do it again and the mixture happens that makes Haskell the longer the short list to leave them both at the same level, that way if one is longer no matter, gives the cut in proportion to the list shorter and there are flush; now let's do something else, we'll mix this concept with endless lists,
let's imagine we want to number the people who are enrolled in something. And I have here my list of 'names,' I will show, and now let's imagine that we want to renumber, well using infinite lists so I put here [1 ..] and you have seen this in other videos and I put 'names' me the numbers so that each name makes me one, two, three, four, because I told him that I have to combine
an infinite list from 1 to infinity with the 'names' list and happens like this is infinite also gives the court looked so good, it's interesting using the ZIP function have already seen, combining different lists Duplas making me lists, well I hope you enjoyed the video, you can give them to like, share, subscribe, 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.