Question 7
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:"_printer(); print (-01 - Print scientists' and 'links' containers"); seientists I printer("Scientists"); links printer("Links"); *scientists.begin() Ieval_namesurname() printer ("Q2 - Write a lambda that returns 'Name' and 'Surname' concatenated with a space"); scientists I transform(eval namesurname()) | printer ("Q3 - Transform tuples with a new one with "Name Surname' concatenated"); cartesian (scientists, links) printer ("04 - Cartesian Product of two containers") where ([-] (const autos tpl) { return eval namesurname() (tol) -- get
(tol); }) printer("Q5 - Filter the elements where evaluated name surname is equal to the full name") i select Uri, PullName, BirthYear, DeathYear> 0 printer ("Q6 - Select Uri, PullName, BirthYear, DeathYear fields in that order"); scientists where (get() equal_to ("Ada"_8)) printer ("Q7 - Filter the elements where Name field is equal to 'Ada'); return 0; 1 CS321 Midterm 2 begins: Q1 - Print scientists' and 'links' containers Scientists (Charles) (Babbage) (1791) (1871) (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) 22 - write a lambda that returns 'Name' and 'Surname' concatenated with a space Charles Babbage 03 - 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) (1871) (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) 27 - Filter the elements where Name field is equal to 'Ada (Ada) (Lovelace) (1815) (1852) 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:"_printer(); print (-01 - Print scientists' and 'links' containers"); seientists I printer("Scientists"); links printer("Links"); *scientists.begin() Ieval_namesurname() printer ("Q2 - Write a lambda that returns 'Name' and 'Surname' concatenated with a space"); scientists I transform(eval namesurname()) | printer ("Q3 - Transform tuples with a new one with "Name Surname' concatenated"); cartesian (scientists, links) printer ("04 - Cartesian Product of two containers") where ([-] (const autos tpl) { return eval namesurname() (tol) -- get(tol); }) printer("Q5 - Filter the elements where evaluated name surname is equal to the full name") i select Uri, PullName, BirthYear, DeathYear> 0 printer ("Q6 - Select Uri, PullName, BirthYear, DeathYear fields in that order"); scientists where (get() equal_to ("Ada"_8)) printer ("Q7 - Filter the elements where Name field is equal to 'Ada'); return 0; 1 CS321 Midterm 2 begins: Q1 - Print scientists' and 'links' containers Scientists (Charles) (Babbage) (1791) (1871) (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) 22 - write a lambda that returns 'Name' and 'Surname' concatenated with a space Charles Babbage 03 - 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) (1871) (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) 27 - Filter the elements where Name field is equal to 'Ada (Ada) (Lovelace) (1815) (1852)