|
C9 Lectures: Dr. Ralf Lämmel - Going Bananas
Dr. Ralf Lämmel returns for an exploration of folds, aka bananas. This is lecture 5 in his C9 Lecture series covering advanced functional programming topics. Welcome back, Ralf! We’re so happy to have you here!Why bananas, Ralf?Banana is functional programming slang for "fold"—an application of the catamorphic recursion scheme most widely known in the higher-order list processing tradition of Bird-Meertens Formalism and the Squiggol community. Erik Meijer used to be known as the "banana man" because of his early research on the subject; he also co-authored the seminal paper with theoretical (categorical) foundations on the subject. Incidentally, the paper used the notation of so-called "banana brackets" (instead of using the plain string "foldr"), which sort of explains why we sometimes say bananas. There is no shortage of crazy paper titles on the subject, by the way: "Functional Programming with Bananas, Lenses, Envelopes, and Barbed Wire," "Bananas in Space: ...," "Dealing with large bananas," "Boxes go bananas: ...," "See more through lenses than bananas," etc.More to the point, foldr is the Swiss Army Knife in functional programming. Monoidal reductions of lists or mapping over lists and many other list-processing idioms can be modeled with the regular recursion operator foldr. Even a beginning lecture on functional programming would have to discuss foldr. Not discussing foldr in a Haskell course, however, is like not discussing for loops in a C# course. Indeed, the lectures on Graham Hutton's introductory Haskell course covered the basics of foldr very well. However, a lot more interesting stuff concerning folds or, say, bananas becomes apparent when one becomes fluent in functional programming. For instance, foldr and friends suddenly make sense for container types other than the concrete list type. Foldr and friends even generalize to arbitrary algebraic datatypes i...
Video Length: 0
Date Found: January 20, 2011
Date Produced: January 20, 2011
View Count: 0
|