Thanks to Functional List Operators

I recently noticed that Functional List Operators have been added. I created a simple example "Find Friday the 13th of a specified year" as shown below. It seems like it can be used in a variety of ways.

This diagram shows all the blocks of the app. The big block "get_13Fri_list" is the main part, and there is no for loop or if-then-else at all. This is a simple example of typical functional programming.

This block uses three functional blocks. In (a), a list of months is converted to a list of the 13th days of the month using map. In (b), the list is converted to a list containing only "Friday" using a filter. Since the elements of this list are date objects, they are converted to dates in normal format using map in (c). In other words, by applying map - filter - map in succession, we obtain a list of answer dates in one continuous flow. It feels refreshing!

3 Likes