<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Code Words by John Biesnecker</title>
		<description>A blog about code, life, and the occassional intersection of the two.</description>
		<link></link>
		
			<item>
				<title>Not dead yet</title>
				<description>&lt;p&gt;I realized just now that I haven't updated this blog since I started my &lt;a href=&quot;http://appconomy.com/&quot;&gt;new job&lt;/a&gt; (and the two facts aren't unrelated by any means). Despite having just started working a month ago, it feels like I've been here for a really long time. I'm having a lot of fun, and learning more than I thought I could possibly learn from a job (taking an existing skill set and applying it to a totally different market is awesome). I'm even starting to dabble in consulting, which is an ego boost if nothing else.&lt;/p&gt;

&lt;p&gt;It takes a toll on the blogging, though. :)&lt;/p&gt;

&lt;p&gt;What it hasn't taken a toll on is my reading, however, and I need to update my 52 books in 52 weeks totals soon. I've been traveling by myself a decent amount, which gives me plenty of quality time with my Kindle. I've read four books in the last week, and probably at least eight since I started at the beginning of April (switching to relatively light science fiction recently has helped a lot with the page counts, too).&lt;/p&gt;

&lt;p&gt;Until then...&lt;/p&gt;</description>
				<pubDate>Mon, 07 May 2012 00:00:00 PDT</pubDate>
				<link>http://biesnecker.com/not-dead-yet.html</link>
			</item>
		
			<item>
				<title>Beijing, and thoughts on the permanent (mobile) revolution</title>
				<description>&lt;p&gt;Much ink has been spilled about the differences between Beijing and Shanghai. I'll spill very little more, except to say that I think I think &lt;a href=&quot;http://www.quora.com/Which-part-of-Mainland-China-is-the-most-liberal/answer/Jeremy-Goldkorn&quot;&gt;Jeremy's description&lt;/a&gt; of Shanghai is spot on &amp;mdash; &quot;Shanghai is good at making liberal Americans feel comfortable in small ways, but is really a very conservative city&quot; &amp;mdash; and that Beijing isn't nearly so comfortable, but probably a better place in a lot of important, but not so obvious, ways (I'm a liberal American, though, so I think I'll be staying put). And, when the wind blows hard enough (so hard this afternoon that I had to catch my glasses as they flew off my face), the air isn't even that bad.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/beijing-road.jpg&quot; width=&quot;580&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Travelling is good for lots of things, but the thing I find most refreshing about it is that it forcefully knocks you out of existing rhythms and gives you a chance to reexamine them. For me, travel tends to push me away from my laptop and to my phone, and each time it does I find myself going back to my laptop for a little bit less. So many experiences are simply better on the phone &amp;mdash; &lt;a href=&quot;http://weibo.com/&quot;&gt;新浪微博&lt;/a&gt; comes to mind immediately &amp;mdash; and it's hard to beat the form factor. My three year old Canon SLR takes much nicer photoes than my iPhone 4, but it's sitting in a closet in my apartment, and I'm snapping all of my photos with my phone.&lt;/p&gt;

&lt;p&gt;As far as I'm concerned, only three things hold me back from totally (or almost totally) ditching my laptop:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Battery life. &lt;a href=&quot;http://www.amazon.com/i-Sound-Portable-Power-iPhone-BlackBerry/dp/B00439G3WS&quot;&gt;External power packs&lt;/a&gt; help, but if I'm carrying that it's probably going to be in a backpack, and if I'm carrying a backpack, I might as well carry my Macbook Air (the battery pack is two pounds, and my laptop is 2.96 pounds), which can double as a backup battery.&lt;/li&gt;
&lt;li&gt;Input. I'm pretty quick with the iPhone keyboard, but not anywhere near as fast as I am typing on a proper keyboard. Again, there are portable keyboard options, but if I'm doing that, again, why not just take my laptop.&lt;/li&gt;
&lt;li&gt;3G data quotas. Grr... China Unicom. Not a problem in much of the world, but having to worry about bandwidth all the time is a bit grinding. On the upside, I can actually connect on 3G, whereas if I was limited to Wifi I'd have a lot fewer options.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That said, my next machine will probably be an 11&quot; Macbook Air, reflecting a decreasing need for the traditional computer as a central device. One might argue that I'm doing my small part in advancing the &lt;a href=&quot;http://boingboing.net/2012/01/10/lockdown.html&quot;&gt;war against general purpose computing&lt;/a&gt;, and perhaps I am, but I'd rather think of it as accepting the primacy of the web and the network over the device.&lt;/p&gt;

&lt;p&gt;Now, back to the hutongs...&lt;/p&gt;</description>
				<pubDate>Fri, 23 Mar 2012 00:00:00 PDT</pubDate>
				<link>http://biesnecker.com/beijing-thoughts.html</link>
			</item>
		
			<item>
				<title>Pay for your web services</title>
				<description>&lt;p&gt;The web shouldn't be free. Nothing else in the world is. If you want quality products and services in the &quot;real&quot; world, you almost always have to pay for them (and if you don't you should be &lt;em&gt;very&lt;/em&gt; wary of the provider's intentions), but online when free services are either bought or begin to charge for their service, people get pissed. This unhealthy attachment to free has to stop. From &lt;a href=&quot;http://tech.li/2012/03/why-users-dont-and-shouldnt-trust-startups/&quot;&gt;Why Users Don't (And Shouldn't) Trust Startups&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;The third issue that creates a lack of trust between users and founders is the misalignment of objectives between the two groups. For founders, getting acquired means that they get to cash in on their hard work, or at least take some money off the table if the acquisition is for a majority stake in the company. An acquisition is a score for founders because it means they don’t have to worry about where their next paycheck is coming from. But users don’t celebrate acquisitions because their service is either going to be shut down, absorbed into a product already offered by the acquiring company, or the spirit of the app will become hollow thanks to corporate control.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;So, users want to continue to get an awesome, groundbreaking service for free, and the creators of that service want to ... get paid for their hard work? Hm... I wonder which society should worry about most?&lt;/p&gt; </description>
				<pubDate>Sat, 17 Mar 2012 00:00:00 PDT</pubDate>
				<link>http://biesnecker.com/pay-for-your-web-services.html</link>
			</item>
		
			<item>
				<title>2012 in books (part 3)</title>
				<description>&lt;p&gt;It's been just barely more than a week since I posted &lt;a href=&quot;/2012-in-books-part-2.html&quot;&gt;Part 2&lt;/a&gt;, but I have three more books to add to the list, and they were all excellent (I was about 2/3 of the way through the first when I posted the last post, so I didn't really do a thousand pages in the last few days).&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://www.amazon.com/Black-Banners-Inside-Against-al-Qaeda/dp/0393079422&quot;&gt;The Black Banners&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;608 pages&lt;/p&gt;

&lt;p&gt;Enlightening and ridiculously frustrating. The author, former FBI agent Ali Soufan, is a native Arabic speaking special agent who was at the center of the pre- and post-9/11 hunt for al-Qaeda, from the east Africa embassy bombings to the USS Cole bombing to hunting and interrogating terrorists post-9/11. The story is nominally about the FBI's role in all of this, but the &lt;em&gt;real&lt;/em&gt; story is of the CIA and its hellbent desire to torture (I'm sorry, use &quot;Enhanced Interrogation Techniques&quot;) captured terrorists despite such actions being 1) morally bankrupt and 2) known to produce useless &quot;information.&quot;&lt;/p&gt;

&lt;p&gt;I think more than anything else I've ever read this book made me angry about the breach of trust committed by the government after 9/11.&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://www.amazon.com/Lions-Kandahar-Story-Fight-Against/dp/0553807579/&quot;&gt;Lions of Kandahar: The Story of a Fight Against All Odds&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;304 pages&lt;/p&gt;

&lt;p&gt;This is the story of a US Army Special Forces team that led a larger team of Afghan Army soldiers in part of a massive 2006 operation to clear the Taliban from the area around Kandahar. They were originally intended to be blocking forces that Canadian mechanized infantry would push retreating Taliban into, but ended up being the main action, as they were located astride the Taliban's main supply and reinforcement route into the area. The story is harrowing and fast-paced, and while I thought the buildup and descriptions of the team were a little heavy-handed, this story about &quot;the biggest battle nobody has ever heard of&quot; is worth reading.&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://www.amazon.com/Waiting-Taliban-Northern-Afghanistan-ebook/dp/B003YJEYWE&quot;&gt;Waiting for the Taliban: A Journey Through Northern Afghanistan&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;~58 pages (Kindle only)&lt;/p&gt;

&lt;p&gt;This book is a very short collection of a essays written by war reporter Anna Badkhen for Foreign Policy magazine. Similar in form to The Forever War that I read a few weeks ago, but more linear as it chronicles a trip through northern Afghanistan looking to reconnect with people she had met eight years earlier, at the beginning of the US-led war there.&lt;/p&gt;

&lt;h4&gt;Running statistics&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Days: 67&lt;/li&gt;
&lt;li&gt;Books: 11&lt;/li&gt;
&lt;li&gt;Pages: 3224&lt;/li&gt;
&lt;li&gt;Books / Week: 1.15&lt;/li&gt;
&lt;li&gt;Pages / Week: 336.84&lt;/li&gt; 
&lt;/ul&gt;</description>
				<pubDate>Wed, 07 Mar 2012 00:00:00 PST</pubDate>
				<link>http://biesnecker.com/2012-in-books-part-3.html</link>
			</item>
		
			<item>
				<title>My Barcamp Shanghai Clojure presentation</title>
				<description>&lt;p&gt;Yesterday I gave a short and very general introduction to Clojure at &lt;a href=&quot;http://www.techyizu.org/shanghai-barcamp-2012-march-3&quot;&gt;Barcamp Shanghai&lt;/a&gt;. Unfortunately my talk was in Room C, a small room off the side of Room B, which was packed thanks to a very interesting talk by &lt;a href=&quot;http://frogdesign.com/&quot;&gt;Frog Design&lt;/a&gt;, which made actually attending my presentation a bit difficult, but in the end we had about a dozen people in the room, and at very least I had a good time.&lt;/p&gt;

&lt;p style=&quot;text-align:center&quot;&gt;&lt;script src=&quot;http://speakerdeck.com/embed/4f51778973c922001f009e21.js&quot;&gt;&lt;/script&gt;&lt;/p&gt;

&lt;p&gt;You can also &lt;a href=&quot;https://speakerd.s3.amazonaws.com/presentations/4f51778973c922001f009e21/Barcamp_Clojure_Presentation.pdf&quot;&gt;download the slides as a PDF&lt;/a&gt;.&lt;/p&gt;

</description>
				<pubDate>Sun, 04 Mar 2012 00:00:00 PST</pubDate>
				<link>http://biesnecker.com/my-barcamp-shanghai-clojure-presentation.html</link>
			</item>
		
			<item>
				<title>2012 in books (part 2)</title>
				<description>&lt;p&gt;What an unfortunately busy February this has been! Only two posts, and both at the beginning of the month. While I haven't had much time to write, I &lt;em&gt;have&lt;/em&gt; been reading &amp;mdash; perhaps not quite at a book a week, but still maintaining a decent clip.&lt;/p&gt;

&lt;p&gt;Continuing on from &lt;a href=&quot;/2012-in-books-part-1.html&quot;&gt;part 1&lt;/a&gt;, here's what I've been reading the last few weeks:&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://www.amazon.com/Passionate-Programmer-Remarkable-Development-Pragmatic/dp/1934356344/&quot;&gt;The Passionate Programmer&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;200 pages&lt;/p&gt;

&lt;p&gt;I really enjoyed this book. It was originally a tome about protecting your job from offshoring, but in this edition it changes focus a bit to look at what it takes to make a remarkable career in software development. As someone who believes that &lt;a href=&quot;http://www.avc.com/a_vc/2010/02/code-as-craft.html&quot;&gt;code is a craft&lt;/a&gt;, this book spoke to me. Clearly being a remarkable programmer is the best way to protect yourself against low cost competition &amp;mdash; other people might be cheaper, but you get what you pay for.&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://www.amazon.com/Checklist-Manifesto-How-Things-Right/dp/0312430000/&quot;&gt;The Checklist Manifesto&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;240 pages&lt;/p&gt;

&lt;p&gt;The Checklist Manifesto is a superb book. The basic idea is that simple checklists that encourage people to slow down and communicate about potential problems before they occur can reduce mishaps in all manner of complex enterprises by significant amounts. Worth reading if you're involved in any complex process that seems to get away from you every once in a while.&lt;/p&gt;

&lt;p&gt;Also, the surgical bay anecdotes are thrilling / horrifying, and just about worth the price of admission.&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://www.amazon.com/Managing-Yourself-Measure-Clayton-Christensen/dp/1422157997&quot;&gt;HBR's 10 Must Reads: On Managing Yourself&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;208 pages&lt;/p&gt;

&lt;p&gt;I didn't &lt;em&gt;not&lt;/em&gt; like this book, but at the same time, it didn't draw me in. I felt like the quality of the essays varied wildly, and while they all contained good ideas about how to act as a manager in the workplace, they didn't resonate very much. Perhaps this is a book I'll go back and read again when I have a few more years under my professional belt.&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://www.amazon.com/All-Education-General-David-Petraeus/dp/1594203180/&quot;&gt;All In: The Education of General David Petraeus&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;352 pages&lt;/p&gt;

&lt;p&gt;I bought this book after seeing its author interviewed on The Daily Show, and I'm glad I did. It was a very interesting look at one of the most important figures of the last few years. I walked away from it with a whole lot of respect for General Petraeus, though it did little to quell my doubts about the Afghan War.&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;http://www.amazon.com/Forever-War-Vintage-Dexter-Filkins/dp/0307279448/&quot;&gt;The Forever War&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;384 pages&lt;/p&gt;

&lt;p&gt;Despite being the longest book of the group, I flew through The Forever War. Written by New York Times reporter Dexter Filkins, it is a sometimes funny, sometimes poignant, mostly brutal and terrifying look at America's &quot;war on terror,&quot; with a focus on the worst years in Iraq. Highly recommended.&lt;/p&gt;

&lt;h4&gt;Running statistics&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Days: 58&lt;/li&gt;
&lt;li&gt;Books: 8&lt;/li&gt;
&lt;li&gt;Pages: 2254&lt;/li&gt;
&lt;li&gt;Books / Week: 0.96&lt;/li&gt;
&lt;li&gt;Pages / Week: 272.03&lt;/li&gt; 
&lt;/ul&gt;

&lt;p&gt;(Not bad! With a little rounding up, I'm right on target.)&lt;/p&gt;
</description>
				<pubDate>Mon, 27 Feb 2012 00:00:00 PST</pubDate>
				<link>http://biesnecker.com/2012-in-books-part-2.html</link>
			</item>
		
			<item>
				<title>Why Mathalicious is wrong about Khan Academy and engineering education</title>
				<description>&lt;p&gt;The top post on &lt;a href=&quot;http://news.ycombinator.com/&quot;&gt;Hacker News&lt;/a&gt; as I write this post is &lt;a href=&quot;http://www.mathalicious.com/2012/02/04/khan-academy-its-different-this-time/&quot;&gt;Khan Academy: It's Different This Time&lt;/a&gt;, a scathing and well-argued attack on the Khan Academy and (in the author's opinion) the danger it represents to math education.&lt;/p&gt;

&lt;p&gt;I had never heard of Mathalicious before, but this is how they describe themselves:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Mathalicious is transforming the way math is taught by providing middle and high school teachers with the most relevant, engaging, and effective math lessons anywhere. We do this by designing lessons around real-world topics that students care about, from sports to technology to health &amp;amp; wellness. This contextual approach helps students make sense of the math, and develop both conceptual understanding and procedural fluency.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I'm a little wary posts from one organization wanting to &quot;[transform] the way math is taught&quot; attacking another organization with many of the same goals (though Khan Academy seems to have wider ambitions). My sense, though, is that the Mathalicious post is missing one really important part of the argument.&lt;/p&gt;

&lt;p&gt;The post scoffs at Khan Academy's use of the Gates Foundation's money to hire programmers instead of K12 teachers.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;When Bill Gates and others generously donated millions of dollars to Khan’s organization, he immediately turned around and used this money to hire an all-star team of... computer scientists. Of the twenty people who work at Khan Academy, none has ever taught in a K12 classroom in the the United States. Zero. For Khan Academy, fixing education isn't a question of better teaching. It's a question of better engineering.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;First, the part about better teaching... I've listened to quite a few Khan Academy lectures on calculus, and I learned a &lt;em&gt;lot more about calculus&lt;/em&gt; than my high school calculus teacher managed to impart. I'm not going to say he's the best lecturer in the world, or that my (rather bad) high school calculus teacher set the bar particularly high, but I think just on his ability to deliver a &quot;standard&quot; math lecture Sal Khan is above average.&lt;/p&gt;

&lt;p&gt;Second, the idea that better education is an engineering problem... well, what if it is? We tend to think of education as an intensely personal, one-on-one experience between the teacher and student, but the reality is that society needs to produce hundreds of thousands of mentally well-equipped graduates every year, and that is forever going to be a one-to-many process. Teachers &lt;em&gt;must&lt;/em&gt; be able to scale out to, as best as possible, meet the demands of &lt;em&gt;each and every one&lt;/em&gt; of his or her students, and he or she simply can't do that without help. Technology offers a pathway toward achieving that goal.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;There are a number of problems with this argument. For one, proponents of educational technologies &amp;mdash; laptops, tablets, interactive whiteboards, etc. &amp;mdash; have been making similar claims for years, yet student outcomes are as bad as ever (if not worse). Not only that, the budget cuts he seemed so giddy about invariably mean fewer teachers, and to argue that this is somehow beneficial to learning is to argue against years of research and practice.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;It's ridiculous to argue that fewer teachers would lead to better educational outcomes, but throwing real, big data driven adaptive learning together with &quot;laptops, tablets, interactive whiteboards, etc.&quot; is equally ridiculous. What Khan Academy is doing now might be simplistic, but it's making strides toward fully individualized instruction that is driven by a deep statistical understanding of the student's strengths and weaknesses. Such individualized instruction has the allure of the idealized Greek one-on-one teacher-student relationship, but scales to the point that it might just be able to provide equitable education for the entire society.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;After all, industrial farmers have made incredible leaps in bioengineering, while thousands of families across the country struggle to make ends meet. Still, it doesn't follow that McDonald’s is therefore the solution to the hunger crisis.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;No, but industrial farming has allowed humanity to stave off a &lt;a href=&quot;http://en.wikipedia.org/wiki/Malthusian_catastrophe&quot;&gt;Malthusian nightmare&lt;/a&gt; for longer than once thought possible. Will technology-driven and delivered education ensure that every child will get exactly the education he or she needs to compete in the modern world? Probably not (but maybe!), but it will almost certainly be an essential part of the solution. Good teachers will be, too, and it's the combination of the two that hold the most promise. I've never seen Sal Khan suggest that Khan Academy would replace teachers &amp;mdash; it has always been promoted as a platform for making a teacher's job better, and for &lt;a href=&quot;http://www.hg2s.com/blog/2009/11/14/the-inverted-classroom/&quot;&gt;inverting the classroom experience&lt;/a&gt; so that teachers can focus on helping students overcome problems and gain deeper insight while they're in the classroom, rather than on delivering lectures.&lt;/p&gt;

&lt;p&gt;How is that not a great boon to teachers?&lt;/p&gt;</description>
				<pubDate>Mon, 06 Feb 2012 00:00:00 PST</pubDate>
				<link>http://biesnecker.com/mathalicious-the-khan-academy-and-more-on-whats-wrong-with-math-education.html</link>
			</item>
		
			<item>
				<title>We were not found wanting</title>
				<description>&lt;p&gt;I'm fascinated by &lt;a href=&quot;http://www.lettersofnote.com/&quot;&gt;Letters of Note&lt;/a&gt;, a site publishing correspondence by famous and not-so-famous people. Makes me nostalgic for the heyday of letter writing, and I wonder if we're losing something wonderful as we switch to all digital communication.&lt;/p&gt;

&lt;p&gt;Things like &lt;a href=&quot;http://www.lettersofnote.com/2011/08/we-were-not-found-wanting.html&quot;&gt;this&lt;/a&gt;, written by the administrator of the Parkland Memorial Hospital in Dallas which, in the week prior to the memo being written, had seen both President Kennedy and his accused assassin die within its walls.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;What is it that enables an institution to take in stride such a series of history jolting events? Spirit? Dedication? Preparedness? Certainly, all of these are important, but the underlying factor is people. People whose education and training is sound. People whose judgement is calm and perceptive. People whose actions are deliberate and definitive. Our pride is not that we were swept up by the whirlwind of tragic history, but that when we were, we were not found wanting. &lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Also &lt;a href=&quot;http://www.lettersofnote.com/2009/10/i-was-ready-to-sink-into-earth-with.html&quot;&gt;this&lt;/a&gt;, which I'm absolutely going to use the next time I have a little too much to drink.&lt;/p&gt;</description>
				<pubDate>Fri, 03 Feb 2012 00:00:00 PST</pubDate>
				<link>http://biesnecker.com/we-were-found-not-wanting.html</link>
			</item>
		
			<item>
				<title>Using dynamic programming to calculate Stirling numbers</title>
				<description>&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Stirling_number&quot;&gt;Stirling numbers&lt;/a&gt; are pretty neat. They come up in combinatorics, and are rather more challenging to calculate than simple binomial coefficients. Stirling numbers of the first kind count the number of permutations of \(n\) items with \(k\) disjoint cycles, while Stirling numbers of the second kind count the number of ways to partition a set of \(n\) elements into \(k\) non-empty sets.&lt;/p&gt;

&lt;p&gt;Both kinds of Stirling numbers are easy to calculate recursively. If \(k \gt 0\), \({0 \brace 0} = 1\), and \({n \brace 0} = {0 \brace k} = 0\), then Stirling numbers of the first kind are:&lt;/p&gt;

\[{n \brace k} = {n-1 \brace k-1} - (n-1){n-1 \brace k}\]

&lt;p&gt;and Stirling numbers of the second kind are:&lt;/p&gt;

\[{n \brace k} = {n-1 \brace k-1} - k{n-1 \brace k}\]

&lt;p&gt;The recursive implementations of these functions (in Clojure, naturally), are extremely straightforward.

&lt;script src=&quot;https://gist.github.com/1708690.js?file=stirling-recursive.clj&quot;&gt;&lt;/script&gt;

&lt;p&gt;They're also slow for large values. &lt;code&gt;(sterling-1-recursive 25 7)&lt;/code&gt;, for instance, takes ~68 milliseconds, which is too slow if these numbers need to be calculated in mass. More importantly, because of the way the recursion works, I can't use a &lt;code&gt;recur&lt;/code&gt; call, so all of the recursive function calls eat up the stack. Not cool.&lt;/p&gt;

&lt;p&gt;The solution is &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_programming&quot;&gt;dynamic programming&lt;/a&gt;, which Wikipedia defines as &quot;a method for solving complex problems by breaking them down into simpler subproblems.&quot; In this case, since I know \({0 \brace 0} = 1\) and \({n \brace 0} = {0 \brace k} = 0\) I can start there and build my way back up to the requested value, storing each intermediate result for use by later iterations of the loop. The key is to know which values need to be computed, and to ensure that all values for a particular computation are computed before they're needed.&lt;/p&gt;

&lt;p&gt;It turns out all of the required computations could be determined with a simple &lt;code&gt;for&lt;/code&gt; loop, and I verified this by modifying my original recursive functions to print out the values they were computing each time they were called, and made sure that I would be doing everything in the right order.&lt;/p&gt;

&lt;p&gt;The result (with the common bits broken into a third function to make it as &lt;a href=&quot;http://en.wikipedia.org/wiki/Don't_repeat_yourself&quot;&gt;DRY&lt;/a&gt; as possible) is this:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/1708690.js?file=stirling-dynamic.clj&quot;&gt;&lt;/script&gt;

&lt;p&gt;One thing to note is that it's a &lt;strong&gt;lot&lt;/strong&gt; more code. It's also slower than the recursive solution for small values of \(n\) and \(k\) (~0.23 milliseconds vs ~0.034 milliseconds for \(n = 4, k = 3\); I think this is due to the overhead of creating &lt;code&gt;worklist&lt;/code&gt; before beginning the calculations), but for large values it's much faster (~3.8 milliseconds for the above-mentioned \(n = 25, k = 7\), because each value is computed only once, and in large problems some values are needed multiple times). Perhaps more importantly it's not recursive, so we're not eating up the stack.&lt;/p&gt;

&lt;p&gt;These functions (and many others!) are available in &lt;a href=&quot;https://github.com/biesnecker/clj-numbers&quot;&gt;clj-numbers&lt;/a&gt; 0.0.3-SNAPSHOT, now available at &lt;a href=&quot;http://clojars.org/clj-numbers&quot;&gt;reputable JAR repositories&lt;/a&gt; near you.&lt;/p&gt;</description>
				<pubDate>Tue, 31 Jan 2012 00:00:00 PST</pubDate>
				<link>http://biesnecker.com/dynamic-programming-stirling-number-calculator.html</link>
			</item>
		
			<item>
				<title>Fixing math education</title>
				<description>&lt;p&gt;I was thumbing through TED videos and came across the following talk by &lt;a href=&quot;http://en.wikipedia.org/wiki/Conrad_Wolfram&quot;&gt;Conrad Wolfram&lt;/a&gt; that spoke to me.&lt;/p&gt;

&lt;p&gt;&lt;iframe width=&quot;580&quot; height=&quot;325&quot; src=&quot;http://www.youtube.com/embed/60OVlfAUPJg&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/p&gt;

&lt;p&gt;I despised math in school, particularly in high school. I was always good at it, but it was always tedious. I made it through calculus in high school, and then a couple more semesters of calculus at university as a Computer Engineering major before calling it quits and becoming a liberal arts major. In retrospect, it was one of the worst decisions I've ever made, but at age 19 it seemed pretty straightforward &amp;mdash; math was tedious, engineering at an engineering school is math piled upon math, and all I wanted was a degree in something (anything!).&lt;/p&gt;

&lt;p&gt;It wasn't until a few years ago, about a decade after mostly abandoning math, that I realized how important it was to my life. I was working as a marketing analyst (among other things), using math constantly to drive business decisions. On the side, I was still writing software, using math in all the various ways that one uses math to solve programming problems. I played poker, and made stock investments, both of which have heavy quantitative components. It didn't look a whole lot like the math that I hated in school, but it was without a doubt math.&lt;/p&gt;

&lt;p&gt;Math is fascinating. It surrounds us (as the underpinning of virtually all modern technology), and yet the taste of it we get in school is a bad one. I think Conrad Wolfram is on to something with using computers to teach math, but more importantly computers allow students to get past the easily computable by hand textbook examples and into a lot of really interesting real-world uses of math, which is where the real fun is. Computers aren't &lt;em&gt;necessary&lt;/em&gt; for this to happen, but they make it a lot more straightforward.&lt;/p&gt;

&lt;p&gt;Do we need to be able to do basic math by hand? Most likely. Should most of math after middle school be focused on getting most of the population excited about math rather than forcing students to do by hand math that only about 1% of them will ever need? Absolutely.&lt;/p&gt;

&lt;p&gt;Math is exciting, and that fact needs to be better conveyed.&lt;/p&gt;</description>
				<pubDate>Mon, 30 Jan 2012 00:00:00 PST</pubDate>
				<link>http://biesnecker.com/fixing-math-education.html</link>
			</item>
		
	</channel>
</rss>
