Question 6
// Below are written for you and shall not be changed. int main(int,char. 11) auto scientists - Scientists "Charles", "Babbage", 1791, 1871), "Ada", "Lovelace", 1815, 1852), "Alan", "Turing", 1912, 1954). auto links = Links "Ada Lovelace","https://en.wikipedia.org/wiki/Ada Lovelace"}, {"Alan Turing","https://en.wikipedia.org/wiki/Alan Turing"}, "C3321 Midtern2 begins:"_8 I printer(); print (-01 - Print 'scientists' and 'links' containers"); scientists printer ("Scientists"); links printer("Links"); #scientists.begin() Ieval_name surname printer ("Q2 - Write a lambda that returns 'Name' and 'Surname' concatenated with a space"); scientists I transform(eval_nanesurname()) i printer ("Q3 - Transform tuples with a new one with 'Name Surname' concatenated"); cartesian (scientists, links) | printer ("Q4 - Cartesian Product of two containers") where ([-] (const autos tpl) { return eval namesurname() (tpl) -- get
(tpl); } I printer ("Q5 - Filter the elements where evaluated name surname is equal to the full name") I select i printer ("Q6 - Select Uri, PullName, BirthYear, DeathYear fields in that order"); scientists where (get() equal_to ("Ada"_8)) printer ("07 - Filter the elements where Nane field is equal to 'Ada'); return 0; 1 CS321 Midterm 2 begins: Q1 - Print scientists' and 'links' containers Scientists (Charles) (Babbage) (1791) (1971) (Ada) (Lovelace) (1815) (1852) (Alan) (Turing) (1912) (1954) Links (Ada Lovelace) (https://en.wikipedia.org/wiki/Ada Lovelace) (Alan Turing) (https://en.wikipedia.org/wiki/Alan Turing) 02 - Write a lambda that returns 'Name' and 'Surname' concatenated with a space Charles Babbage 23 - Transform tuples with a new one with 'Name Surname' concatenated Charles Babbage Ada Lovelace Alan Turing 04 - Cartesian Product of two containers (Charles) (Babbage) (1791) (1871) (Ada Lovelace) (https://en.wikipedia.org/wiki/Ada Lovelace) (Charles) (Babbage) (1791) (1971) (Alan Turing) (https://en.wikipedia.org/wiki/Alan Turing) (Ada) (Lovelace) (1815) (1852) (Ada Lovelace) (https://en.wikipedia.org/wiki/Ada Lovelace) (Ada) (Lovelace) (1815) (1852) (Alan Turing) (https://en.wikipedia.org/wiki/Alan Turing) (Alan) (Turing) (1912) (1954) (Ada Lovelace) (https://en.wikipedia.org/wiki/Ada Lovelace) (Alan) (Turing) (1912) (1954) (Alan Turing) (https://en.wikipedia.org/wiki/Alan Turing) 05 - Filter the elements where evaluated name surname is equal to the full name (Ada) (Lovelace) (1815) (1852) (Ada Lovelace) (https://en.wikipedia.org/wiki/Ada Lovelace) (Alan) (Turing) (1912) (1954) (Alan Turing) (https://en.wikipedia.org/wiki/Alan_Turing) 26 - Select Url, FullName, BirthYear, DeathYear fields in that order (https://en.wikipedia.org/wiki/Ada Lovelace) (Ada Lovelace) (1815) (1852) (https://en.wikipedia.org/wiki/Alan_Turing) (Alan Turing) (1912) (1954) // Below are written for you and shall not be changed. int main(int,char. 11) auto scientists - Scientists "Charles", "Babbage", 1791, 1871), "Ada", "Lovelace", 1815, 1852), "Alan", "Turing", 1912, 1954). auto links = Links "Ada Lovelace","https://en.wikipedia.org/wiki/Ada Lovelace"}, {"Alan Turing","https://en.wikipedia.org/wiki/Alan Turing"}, "C3321 Midtern2 begins:"_8 I printer(); print (-01 - Print 'scientists' and 'links' containers"); scientists printer ("Scientists"); links printer("Links"); #scientists.begin() Ieval_name surname printer ("Q2 - Write a lambda that returns 'Name' and 'Surname' concatenated with a space"); scientists I transform(eval_nanesurname()) i printer ("Q3 - Transform tuples with a new one with 'Name Surname' concatenated"); cartesian (scientists, links) | printer ("Q4 - Cartesian Product of two containers") where ([-] (const autos tpl) { return eval namesurname() (tpl) -- get(tpl); } I printer ("Q5 - Filter the elements where evaluated name surname is equal to the full name") I select i printer ("Q6 - Select Uri, PullName, BirthYear, DeathYear fields in that order"); scientists where (get() equal_to ("Ada"_8)) printer ("07 - Filter the elements where Nane field is equal to 'Ada'); return 0; 1 CS321 Midterm 2 begins: Q1 - Print scientists' and 'links' containers Scientists (Charles) (Babbage) (1791) (1971) (Ada) (Lovelace) (1815) (1852) (Alan) (Turing) (1912) (1954) Links (Ada Lovelace) (https://en.wikipedia.org/wiki/Ada Lovelace) (Alan Turing) (https://en.wikipedia.org/wiki/Alan Turing) 02 - Write a lambda that returns 'Name' and 'Surname' concatenated with a space Charles Babbage 23 - Transform tuples with a new one with 'Name Surname' concatenated Charles Babbage Ada Lovelace Alan Turing 04 - Cartesian Product of two containers (Charles) (Babbage) (1791) (1871) (Ada Lovelace) (https://en.wikipedia.org/wiki/Ada Lovelace) (Charles) (Babbage) (1791) (1971) (Alan Turing) (https://en.wikipedia.org/wiki/Alan Turing) (Ada) (Lovelace) (1815) (1852) (Ada Lovelace) (https://en.wikipedia.org/wiki/Ada Lovelace) (Ada) (Lovelace) (1815) (1852) (Alan Turing) (https://en.wikipedia.org/wiki/Alan Turing) (Alan) (Turing) (1912) (1954) (Ada Lovelace) (https://en.wikipedia.org/wiki/Ada Lovelace) (Alan) (Turing) (1912) (1954) (Alan Turing) (https://en.wikipedia.org/wiki/Alan Turing) 05 - Filter the elements where evaluated name surname is equal to the full name (Ada) (Lovelace) (1815) (1852) (Ada Lovelace) (https://en.wikipedia.org/wiki/Ada Lovelace) (Alan) (Turing) (1912) (1954) (Alan Turing) (https://en.wikipedia.org/wiki/Alan_Turing) 26 - Select Url, FullName, BirthYear, DeathYear fields in that order (https://en.wikipedia.org/wiki/Ada Lovelace) (Ada Lovelace) (1815) (1852) (https://en.wikipedia.org/wiki/Alan_Turing) (Alan Turing) (1912) (1954)