{"id":3365,"date":"2023-08-21T13:56:22","date_gmt":"2023-08-21T17:56:22","guid":{"rendered":"https:\/\/blog.wholetomato.com\/?p=3365"},"modified":"2023-08-21T13:56:56","modified_gmt":"2023-08-21T17:56:56","slug":"summer-codefest-lambdas-go-baa-recap","status":"publish","type":"post","link":"https:\/\/stage.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/","title":{"rendered":"Summer Codefest: Lambdas go Baa! [Recap]"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\r\n<div class=\"ez-toc-title-container\"><p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\r\n<\/div><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/stage.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/#Webinar_overview_A\" >Webinar overview:\u00c2\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/stage.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/#When_to_use_lambdas\" >When to use lambdas:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/stage.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/#Comparing_lambdas_with_traditional_functor\" >Comparing lambdas with traditional functor<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/stage.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/#Summary_other_tips_for_using_lambdas\" >Summary: other tips for using lambdas<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/stage.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/#Slide_Deck_Presentation\" >Slide Deck Presentation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/stage.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/#Replay\" >Replay<\/a><\/li><\/ul><\/nav><\/div>\r\n<h2><span class=\"ez-toc-section\" id=\"Webinar_overview_A\"><\/span><span style=\"font-weight: 400;\">Webinar overview:\u00c2\u00a0<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">This presentation by product manager, David Millington, talks about the convenient way to define an anonymous function object added in C++11. This topic was chosen because while it&#8217;s extremely useful, the data we see is that there tend to be two groups of C++ developers: those who use them extensively, and those who barely use them.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"When_to_use_lambdas\"><\/span><span style=\"font-weight: 400;\">When to use lambdas:<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">The main benefits of using lambdas are:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Improves readability for you or your team.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Anonymity makes them easier to maintain (no names needed for smaller functions\/functors).<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Localizes functions to your code.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Furthermore, lambdas are especially useful if your logic goes inside something else. These <\/span><i><span style=\"font-weight: 400;\">code layering <\/span><\/i><span style=\"font-weight: 400;\">problems are a nuisance to reading code\u00e2\u20ac\u201dlambdas make it easier to \u00e2\u20ac\u0153localize\u00e2\u20ac\u009d logic.<\/span><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?ssl=1\"><img decoding=\"async\" data-attachment-id=\"3370\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/screenshot-2023-08-22-at-1-51-00-am\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?fit=1722%2C968&amp;ssl=1\" data-orig-size=\"1722,968\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot 2023-08-22 at 15100 AM\" data-image-description=\"&lt;p&gt;#image_title&lt;\/p&gt;\n\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?fit=1024%2C576&amp;ssl=1\" class=\"size-medium wp-image-3370 aligncenter\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=300%2C169&#038;ssl=1\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=1536%2C863&amp;ssl=1 1536w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?resize=360%2C202&amp;ssl=1 360w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Screenshot-2023-08-22-at-15100-AM.png?w=1722&amp;ssl=1 1722w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Comparing_lambdas_with_traditional_functor\"><\/span><span style=\"font-weight: 400;\">Comparing lambdas with traditional functor<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div id=\"attachment_3372\" style=\"width: 1034px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?ssl=1\"><img decoding=\"async\" aria-describedby=\"caption-attachment-3372\" data-attachment-id=\"3372\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/summer-codefest_-lambdas-go-baa-webinar-replay-16-22-screenshot\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?fit=1280%2C720&amp;ssl=1\" data-orig-size=\"1280,720\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Summer CodeFest_ Lambdas go Baa Webinar Replay 16-22 screenshot\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?fit=1024%2C576&amp;ssl=1\" class=\"wp-image-3372 size-large\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=1024%2C576&#038;ssl=1\" alt=\"\" width=\"1024\" height=\"576\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?resize=360%2C203&amp;ssl=1 360w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-16-22-screenshot.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/a><p id=\"caption-attachment-3372\" class=\"wp-caption-text\">A comparison between a sort functor written in traditional structure vs a lambda.<\/p><\/div>\n<p><span style=\"font-weight: 400;\">On the left is a standard functor with structs and operators written traditionally. It works and functions just as a lambda would but it is longer and arguably more difficult to comprehend when viewed in the context of actual source code.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">On the other hand, a lambda is seen as significantly shorter and easier to read. With the structure of a lambda, the code being called is emphasized directly after the functions. The syntax is also unmistakable; just look for the following method syntax:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">[ ] &#8211; capture state<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">( ) &#8211; function<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">{ } &#8211; body of method<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Skip to <\/span><a href=\"https:\/\/youtu.be\/0tKmDIRsq8o?t=1098\"><span style=\"font-weight: 400;\">18:18 of the replay<\/span><\/a><span style=\"font-weight: 400;\"> to learn more about lambda syntax and how to structure inline functions.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Summary_other_tips_for_using_lambdas\"><\/span><span style=\"font-weight: 400;\">Summary: other tips for using lambdas<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Here are a couple of other things you should look out for according to the presentation:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/youtu.be\/0tKmDIRsq8o?t=1298\"><span style=\"font-weight: 400;\">Variable capture<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/youtu.be\/0tKmDIRsq8o?t=1421\"><span style=\"font-weight: 400;\">Using auto for the type<\/span><\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?ssl=1\"><img decoding=\"async\" data-attachment-id=\"3374\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/summer-codefest-lambdas-go-baa-recap\/summer-codefest_-lambdas-go-baa-webinar-replay-27-27-screenshot\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?fit=1280%2C720&amp;ssl=1\" data-orig-size=\"1280,720\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Summer CodeFest_ Lambdas go Baa Webinar Replay 27-27 screenshot\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?fit=300%2C169&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?fit=1024%2C576&amp;ssl=1\" class=\"alignnone wp-image-3374\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=738%2C415&#038;ssl=1\" alt=\"\" width=\"738\" height=\"415\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?resize=360%2C203&amp;ssl=1 360w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/Summer-CodeFest_-Lambdas-go-Baa-Webinar-Replay-27-27-screenshot.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 738px) 100vw, 738px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Slide_Deck_Presentation\"><\/span><span style=\"font-weight: 400;\">Slide Deck Presentation<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><iframe src=\"https:\/\/docs.google.com\/presentation\/d\/e\/2PACX-1vTiu3zxkG2_R-sNvYrjVuqhWL4jaJfK8_n8Nbgsx_j0YeKoqD1WykAe0qC6cJjRFnX8E8vrmNIBP-i7\/embed?start=false&amp;loop=false&amp;delayms=3000\" width=\"760\" height=\"469\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Replay\"><\/span><span style=\"font-weight: 400;\">Replay<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><iframe title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/0tKmDIRsq8o\" width=\"760\" height=\"415\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Webinar overview:\u00c2\u00a0 This presentation by product manager, David Millington, talks about the convenient way to define an anonymous function object added in C++11. This topic was chosen because while it&#8217;s extremely useful, the data we&#8230;<\/p>\n","protected":false},"author":213500340,"featured_media":3367,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[672,726359896],"tags":[2426,726359933,726359934,726359932],"class_list":["post-3365","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-and-tricks","category-webinar-recap","tag-c","tag-functions","tag-functors","tag-lambdas"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/08\/16_WTSummer-CodeFest-Individual-Sessions_David-Millington-1920x1080-1.png?fit=1920%2C1080&ssl=1","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfhqii-Sh","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/users\/213500340"}],"replies":[{"embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/comments?post=3365"}],"version-history":[{"count":6,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3365\/revisions"}],"predecessor-version":[{"id":3376,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3365\/revisions\/3376"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/media\/3367"}],"wp:attachment":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/media?parent=3365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/categories?post=3365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/tags?post=3365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}