E20: Experience Functional Programming (Part 3)

Let’s finish our exploration of Underscore.

As before, we’ll use a Hawaii Open Dataset providing Five Years of UH Degree Data. Here’s a screen image of this dataset:

As a reminder, here’s what the uhdata variable’s value looks like:

var uhdata = [
    "CAMPUS":"UH Manoa",
    "GROUP1":"School of Law",
    "GROUP2":"School of Law",
    "CAMPUS":"Kapi`olani CC",
    "CIP_DESC":"Liberal Arts",
    "GROUP1":"General & Pre-Prof Ed",
    "GROUP2":"Liberal Arts",
    "GROUP3":"Liberal Arts",
    "OUTCOME":"Associate Degrees",


Ready to have some more fun?

  1. Start your timer.

  2. Create a fork of your previous practice WOD to use as a basis for this one.

  3. Use the functions provided by the underscore package to implement the following functions. Note that your solutions cannot include a for loop or an if statement!

  4. listCampusDegrees(data). This function can be passed uhdata and returns an object where the property keys are campuses and the values are the number of degrees awarded by the campus. Hint: one approach is to use the groupBy and mapObject functions.

  5. maxDegrees(data). This function can be passed uhdata, computes the number of degrees earned in each year in the data set, and then returns an integer which is the number of degrees earned in the year where the most degrees were earned. Hint: one approach is to use the groupBy, mapObject, values, and max functions.

  6. Press the “update” button to save your code.

  7. Stop your timer and record your time. Be sure to record it, because you will need your WOD time data when you write your technical essay.

Rx: < 12 min Av: 12 - 16 min Sd: 16 - 20 min DNF: 20+ min


Once you’ve finished trying the WOD for the first time, watch me do it.

Standard WOD Caveats

You’ll learn significantly less from watching me solve the WOD if you haven’t attempted the WOD yourself first.

While it’s an achievement to finish the WOD no matter how long it takes, you might experience “diminishing returns” if you work longer than the DNF time. Thus, it is usually strategic to stop working at the DNF time and watch my solution.

After watching my solution, I recommend that you repeat the WOD if you have not achieved at least Av performance. If so, be sure to:

Feel free to keep trying until you make Rx if that’s of interest to you.

Submission Instructions

By the time and date indicated on the Schedule page, submit this assignment via Laulima.

Your submission should contain:

You will receive full credit for this practice WOD as long as you have attempted it at least once and submitted the email with all required data before the due date. Your code does not have to run perfectly for you to receive full credit. However, if you do not repeat each practice WOD until you can finish it successfully in at least AV time, you are unlikely to do well on the in-class WOD. To reduce the stress associated with this course, I recommend that you repeat each practice WOD as many times as necessary to achieve at least AV before its due date.