<div dir="ltr"><div class="gmail_extra"><div>On Wed, Apr 15, 2015 at 1:34 AM, Gautier DI FOLCO <<a href="mailto:gautier.difolco@gmail.com">gautier.difolco@gmail.com</a>> wrote:</div><div>> Some days ago I have participated to a coding dojo* which aimed to be an introduction to functional programming. I have also facilitate 3 of events like this and do several talks on this subject. But I'm kinda disappointed because each time there is a common pattern:</div><div>> 1. Unveil the problem which will be treated</div><div>> 2. Let the attendees solve it</div><div>> 3. Show the FP-ish solution (generally a bunch of map/fold)</div><div>> I think it's frustrating for the attendees (because they don't try to solve it) and gives a false illusion of knowledge.</div><div>> I don't consider myself as a "FP guru" or anything but for me FP is a matter of types and expressions, so when someone illustrate FP via map/fold, it's kind of irritating.</div><div>> Ironically, the best workshop I have done was on functional generalization (you begin by two hard coded functions, sum and product, and you extract Foldable and Monoid), but again, it's not satisfying.</div><div>> We can do better, we should do better.</div><div>> Have you got any feedback/subjet ideas/examples on how to introduce "real" FP to beginners in a short amount of time (like 1-3 hours)?</div><div><br></div><div>Well, functional programming is very much like an elephant. I started</div><div>with it doing Scheme, so while I appreciate what the HM type system</div><div>brings to the table, to me it's not what functional programming is about.</div><div><br></div><div>To me, functional programming is about thinking about functions as</div><div>data, and designing them so you can compose and combine them like you</div><div>would data, as opposed to simply being tools for encapsulating code.</div><div><br></div><div>As such, maps and folds are simple, easy-to-understand higher order</div><div>functions that you can plug other functions into. But such discussions</div><div>tend to highlight map/fold, not how you build the functions that get</div><div>plugged into them.</div><div><br></div><div>To me, a better example would be one of the combinator-based parsing</div><div>libraries. Say Text.XML.Cursor, as in the School of Haskell tutorial</div><div>at <a href="https://www.fpcomplete.com/school/starting-with-haskell/libraries-and-frameworks/text-manipulation/tagsoup">https://www.fpcomplete.com/school/starting-with-haskell/libraries-and-frameworks/text-manipulation/tagsoup</a>.</div><div><br></div><div>   <mike</div><div><br></div></div></div>