[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-657834-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-657834-en":130},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","hofs-and-environment-diagrams-learning-objectives","HOFs and Environment Diagrams - Learning Objectives","","A set of lecture notes from UC Berkeley Computer Science 88 by Michael Ball covering Higher Order Functions (HOFs) and their use with list transformations. It explains functional list operations including map, filter, and reduce, with goals, input-output behavior, and examples. It also addresses how Python’s filter can return original values even when the predicate is non-boolean, and outlines learning objectives and reduce’s functional structure and requirements.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/hofs-and-environment-diagrams-learning-objectives/657834/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/hofs-and-environment-diagrams-learning-objectives/657834.png","ImageObject",300,407,{"name":42,"@type":43},"8796093062539","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-30","2026-10-26",true,{"@type":52,"interactionType":53,"userInteractionCount":30},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What are the three hallmark higher order functions covered in these notes?","Question",{"text":62,"@type":63},"The notes cover map, filter, and reduce as common Higher Order Functions for transforming or combining list data.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How does map differ from filter in terms of output?",{"text":67,"@type":63},"map transforms every item and returns a new list with the same length, while filter returns a list with possibly fewer items where values are the same as the original but selected by a predicate.",{"name":69,"@type":60,"acceptedAnswer":70},"Why can 0 appear in the output of filter in the examples?",{"text":71,"@type":63},"The notes explain that filter calls the predicate function but always returns the original value, so non-boolean predicate behavior can still include 0 based on truthiness.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},657834,1793051955,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":96,"slug":129},19,"General","general",{"code":4,"msg":81,"data":131},{"doc_id":78,"user_id":132,"nickname":42,"user_avatar":11,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":133,"file_id":134,"file_url":135,"file_type":136,"file_size":137,"view_count":30,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":138,"language":139,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":12,"update_tm":143,"read_time":144},8796093062539,"Computational Structures in Data Science   \nUC Berkeley EECS Lecturer Michael Ball  \nHOFs & Environment Diagrams  \nUC Berkeley | Computer Science 88 | Michael Ball | [https://cs88.org](https://cs88.org)  \nAnnouncements  \n• The weeks-long saga is over!  \n• Early next week:  \n– TWO new sections added  \n– Will send out a form for transferring work from 61A  \n– Will give extensions for Labs 1, 2, 3 and Homework 1, 2  \n• if I don't respond to your email about enrollment, I'm sorry.  \nUC Berkeley | Computer Science 88 | Michael Ball | [http://cs88.org](http://cs88.org)  \nComputational Structures in Data Science   \nUC Berkeley EECS Lecturer Michael Ball  \nHOFs and Lists  \nUC Berkeley | Computer Science 88 | Michael Ball | [https://cs88.org](https://cs88.org)  \nFunctional List Operations  \n• Goal: Transform a list, and return a new result  \n• We'll use 3 functions that are hallmarks of functional programming  \n• Each of these takes in a function and a sequence  \n\n| Function Name | Action | Input arguments | Input Fn. Returns | Output List |\n| --- | --- | --- | --- | --- |\n| map | Transform every item | 1 argument (each item) | \"Anything\", a new item | List of the same length, but possibly new values |\n| filter | Return a list with fewer items | 1 argument (each item) | A Boolean | List with possibly fewer items, but values are the same |\n| reduce | \"Combine\" items together | 2 arguments (current item, and the previous result) | Type should match the type each item | Usually a \"single\" item |\n\nUC Berkeley | Computer Science 88 | Michael Ball | [http://cs88.org](http://cs88.org)  \nFilter and Non-Boolean Functions  \n>>> list(filter(add_ 2, range(10)))[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]>>> if 0:  \n... print(\"0 is a true value\")... else:  \n... print(\"0 is a false value\")...  \n0 is a false value  \nWhy is 0 in the output of 0ur filter?  \nUC Berkeley | Computer Science 88 | Michael Ball | [http://cs88.org](http://cs88.org)  \nFilter and Non-Boolean Functions  \n>>> [ x for x in range(10) if add_ 2(x) ]  \nWhy is 0 in the output of 0ur filter?  \nFilter calls our function, but always returns the original value!  \nUC Berkeley | Computer Science 88 | Michael Ball | [http://cs88.org](http://cs88.org)  \nComputational Structures in Data Science   \nUC Berkeley EECS Lecturer Michael Ball  \nLists & Higher Order Functions  \nReduce  \nUC Berkeley | Computer Science 88 | Michael Ball | [https://cs88.org](https://cs88.org)  \nLearning Objectives  \n• Learn three new common Higher Order Functions:  \n– map, filter, reduce  \n• These each apply a function to a sequence (list) of data  \n• Reduce: “Combines” items together, probably doesn’t return a list.  \n– Input: A 2 item function and a sequence  \n– A single value  \nUC Berkeley | Computer Science 88 | Michael Ball | [http://cs88.org](http://cs88.org 8)[ 8](http://cs88.org 8)  \nREDUCE  \nreduce(function, list_of_inputs) Successively combine items of our sequence  \n• function: add(), takes 2 inputs gives us 1 value. Inputs (Domain):  \n• Function, with 2 inputs  \n• Sequence Output (Range):  \n• An item, the type is the output of our function.  \nNote: We must import reduce from functools!  \ndef reduce ( function , sequence ):  \nresult = function(sequence[ 0 ], sequence[ 1 ])  \nfor index in range ( 2 , len (sequence)):  \nresult = function(result, sequence[index]) return result  \nUC Berkeley | Computer Science 88 | Michael Ball | [http://cs88.org](http://cs88.org)  \nComputational Structures in Data Science   \nUC Berkeley EECS Lecturer Michael Ball  \nLists & Higher Order Functions  \nAcronym  \nUC Berkeley | Computer Science 88 | Michael Ball | [https://cs88.org](https://cs88.org)","cbCaivsaluFuqkQS","https://ap.wps.com/l/cbCaivsaluFuqkQS","pdf",374968,22,"English","# HOFs and Environment Diagrams\n# HOFs and Lists\n## Functional List Operations\n## Filter and Non-Boolean Functions\n# Lists & Higher Order Functions\n## Reduce\n## Learning Objectives\n## Acronym","[{\"question\":\"What are the three hallmark higher order functions covered in these notes?\",\"answer\":\"The notes cover map, filter, and reduce as common Higher Order Functions for transforming or combining list data.\"},{\"question\":\"How does map differ from filter in terms of output?\",\"answer\":\"map transforms every item and returns a new list with the same length, while filter returns a list with possibly fewer items where values are the same as the original but selected by a predicate.\"},{\"question\":\"Why can 0 appear in the output of filter in the examples?\",\"answer\":\"The notes explain that filter calls the predicate function but always returns the original value, so non-boolean predicate behavior can still include 0 based on truthiness.\"}]","HOFs and Environment Diagrams - Learning Objectives | PDF",1792991658,55]