Simeon Franklin

Blog :: List Comprehensions for Modesto Scripting Languages Meetup

2 March 2012

Monday night we had our second Modesto Scripting Languages Meetup. This was our first presentations-style meeting and all the presenters did a great job - James did a live demo of building a simple app in web2py, Nathan covered the MVC pattern in web applications and I talked about list processing generally and list comprehensions in Python specifically.

Because we're trying to be a multilingual meetup I didn't want my presentation to be purely Python-vangelism - so I used PHP to talk about identifying problems that can be reduced to list processing problems and using functional tools in PHP to solve the problems more descriptively and less procedurally. After talking about the potential drawbacks in terms of legibility to using array_map, array_reduce, and array_filter in PHP I introduced Python's list comprehension feature as a language pattern designed to operate like map and filter but with much greater clarity - list comprehensions read like english, don't require (anonymous) functions to encapsulate the mutation and condition parts yet remain terse.

My slides are up - I'm using Deck.js to build an html presentation with asciidoc - just hit the space bar to advance the presentation.


blog comments powered by Disqus