Haskell

Haskell 15: functions Duplas

20 videos

111 minutes

Hello world are such I welcome this new video we are doing more Haskell and we will move forward with features that are specifically designed for tandems, within duplas remember that depending on the size have different nomenclatures, if two pairs elements,

if they are three triples elements and so on and these functions are going to see are unique to duplas which serve to return the element that is in that position as we want to find, remember that if I have a list (list) and have two elements here have two elements

I for example 'one' and 'two' and want to access one of them through the index to the following, list put double exclamation mark (!!) and then I wanted index access, for example the zero rate as a result gave me the information that was in that position that is one,

with that string, but if I want to do with a pair it does not work well, for example I have a pair and now no longer brackets if no parentheses Remember! and here I have 'one' and here as we saw that we can mix data types we will mix and will not be any problems

but if I want to access the zero position fails, if I want to do otherwise as perhaps you are used to with other languages ​​and see that does not work, if I want to do with parentheses not work, finally the different options that may be of other languages ​​do not work,

then what is the way here if I have this pair with those values ​​which is how to access these elements, good functions used are the following, we fst first and then put the pair and we would return the 'one', the first position to the second if we would put SCD second and then we would put pair and return the second position,

I can also do indicating a pair, I here could put 4.8 and true and I returned the first position, so it is not necessary to put the name of a duo who have already created directly as you imagine, simply putting the function and then the duo and they want to extract both the first member and the second,

Remember fst (first) and SCD (second), well this is the video of these two features designed to tandems, I hope you enjoyed it so you can give it to like, share, subscribe and see you in more videos.

To find new courses, subscribe. There will be no spam, promised :)

About the Author

foto de jotajotavm
José Javier Villena

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.