Zachary Weachter

@fKTIHvLTRcy58IeVqOe_8w

Joined on Sep 1, 2021

  • Lab 6: Understanding Recursion In lecture, we have started to write recursive functions, where a function body calls the same function to process a smaller part of the data. This lab gives you practice with understanding how this works and writing recursive functions of your own. In the first part of lab, you'll draw function diagrams on paper to visualize recursive function calls. Call a TA over if you get confused or need clarification. Part 1: Creating Call-Record Chains Exercise 1: Binning Numbers by their Signs In data analysis, we often take a column of data and convert it into a small number of fixed "bins": this lets us cluster data for analysis. For example, we refer to December, January, and February as "winter", while March, April, and May are referred to as "spring". The following function bins numbers based on their signs (positive, negative, and zero): fun signs(numlist :: List<Number>) -> List<String>: cases (List) numlist: | empty => empty
     Like  Bookmark