<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ethan Fast</title>
	<atom:link href="http://blog.ethanjfast.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ethanjfast.com</link>
	<description>Lambdas, Hacks, and Fiction</description>
	<lastBuildDate>Mon, 08 Mar 2010 19:03:25 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Analyzing Word Frequencies with Clojure, Enlive and Incanter</title>
		<link>http://blog.ethanjfast.com/2010/03/analyzing-word-frequencies-with-clojure-enlive-and-incanter/</link>
		<comments>http://blog.ethanjfast.com/2010/03/analyzing-word-frequencies-with-clojure-enlive-and-incanter/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 18:39:48 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Clojure]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Enlive]]></category>
		<category><![CDATA[Incanter]]></category>
		<category><![CDATA[Wordy]]></category>

		<guid isPermaLink="false">http://blog.ethanjfast.com/?p=381</guid>
		<description><![CDATA[I&#8217;ve long been interested in getting a better feel for Incanter, a statistical computing and graphical environment for Clojure. So gifted with the fleeting favors of my muse (otherwise known as free time), I thought I&#8217;d put together a small library &#8212; although it&#8217;s not quite a library, yet &#8212; for analyzing word-use patterns on blogs and webpages.
To do [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve long been interested in getting a better feel for <a href="http://incanter.org/">Incanter</a>, a statistical computing and graphical environment for Clojure. So gifted with the fleeting favors of my muse (otherwise known as <em>free time</em>), I thought I&#8217;d put together a small library &#8212; although it&#8217;s not quite a library, yet &#8212; for analyzing word-use patterns on blogs and webpages.</p>
<p>To do this, I drew a bit of help from <a href="http://github.com/cgrand/enlive">Enlive</a>, which functions primarily as a templating library, but has a few features useful for screen-scraping. This was perhaps a bit of overkill, as I only ended up using one of it&#8217;s functions, <em>html-resource</em>, which takes an URL as input, and outputs an hash that nicely represents a web-page&#8217;s structure.</p>
<p>What I ended up is <a href="http://github.com/Ejhfast/wordy">wordy</a>, which at the moment can do a simple word-count frequency analysis on a given page. That is, it counts how often words used, filtering (if desired) on word length. In just a bit, I&#8217;ll get into some of the more interesting aspects of coding it  up, but first,  here is a simple use case.</p>
<p>Running the following in slime&#8230;<br />
<code>(graph-words "http://ethanjfast.com" 5 5 1)</code></p>
<p style="text-align: center;"><img class="aligncenter" title="As applied to this blog." src="/images/ethanjfast.com.png" alt="" width="500" /></p>
<p style="text-align: left;">Where the parameters correspond to:</p>
<ul>
<li>ethanjfast.com -&gt; web page to look at</li>
<li>5 -&gt; minimum length (letter count) of word for first anaylsis</li>
<li>5 -&gt; minimum length of word for last anaylsis</li>
<li>1 -&gt; the amount of word length to increment by between the first and last anaylsis</li>
</ul>
<p>To make this a bit clearer, consider a different run:<br />
<code>(graph-words "http://ycombinator.posterous.com" 3 10 3)</code></p>
<p style="text-align: center;"><img class="aligncenter" title="Ycombinator Run" src="/images/ycom2.png" alt="" width="500" /></p>
<p style="text-align: left;">Here wordy does three analyses, with minimum word lengths of 3, 6, and 9 respectively. Clearly, I have some work to do insofar as these graphs look rather pathetic, but it was nice to get incanter working.</p>
<p style="text-align: left;">Now, onto some implementation details. Most of the code is quite simple, so I&#8217;ll just go through a few functions that may have some value to someone learning Clojure. For instance, here is <em>rec-map</em>, a function which recursively traverses the map/list structure returned by <em>html-resource</em>.</p>
<script src="http://gist.github.com/325414.js"></script>
<p>Basically, this function filters out all page content that doesn&#8217;t match specific tags (getting rid of links, css, javascript, ect.) But at first glance, you might wonder why I used <em>trampoline</em> rather than <em>recur</em>. After all, <em>trampoline</em> is used to recurse between two different functions, and it looks very much like <em>rec-map</em> is calling itself. Well, the trick is that I am calling <em>trampoline</em> inside the function passed to map, so <em>recur</em> will fail spectacularly (and in a very confusing manner). So watch out for recursion within anonymous functions!</p>
<p>Here is another bit of code, where I create the graph with Incanter.</p>
<script src="http://gist.github.com/325432.js"></script>
<p>The :group-by parameter is slightly unintuitive. To use it, you make a new vector of labels, each label mapping to a counterpart in the data vector. All data with the same label are then put into the same group (e.g for data ["You" "Me" "I"] [3 2 4] one might use the label vector [0 1 1] to group &#8220;Me&#8221; and &#8220;I&#8221; together). The rest is fairly self-explanatory, but I&#8217;ll mention one thing that I didn&#8217;t know until this morning. You can&#8217;t nest the # function shortcut. For instance, the following would not work:</p>
<p><code>(map #(map #(first %1) %1) lst)</code></p>
<p>It&#8217;s rather obvious in retrospect, I know. But I was dumb enough to try it. That&#8217;s all for now, and the code is available on <a href="http://github.com/Ejhfast/wordy">github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ethanjfast.com/2010/03/analyzing-word-frequencies-with-clojure-enlive-and-incanter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>As it turns out is quite innocuous</title>
		<link>http://blog.ethanjfast.com/2010/03/as-it-turns-out-is-quite-innocuous/</link>
		<comments>http://blog.ethanjfast.com/2010/03/as-it-turns-out-is-quite-innocuous/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 12:00:57 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Writing]]></category>
		<category><![CDATA[as it turns out]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[paul graham]]></category>

		<guid isPermaLink="false">http://blog.ethanjfast.com/?p=368</guid>
		<description><![CDATA[What a strange title, you say! Well, this is true, but as it turns out, you are quite likely to have parsed it incorrectly (that is, unless you have just come from this post on Hacker News).
In any case, there was a recent small flurry of activity regarding Paul Graham&#8217;s use of the rhetorical device [...]]]></description>
			<content:encoded><![CDATA[<p>What a strange title, you say! Well, this is true, but as it turns out, you are quite likely to have parsed it incorrectly (that is, unless you have just come from <a href="http://news.ycombinator.com/item?id=1162965">this post</a> on Hacker News).</p>
<p>In any case, there was a recent small flurry of activity regarding Paul Graham&#8217;s use of the rhetorical device &#8220;it turns out.&#8221; Not to put too fine a point on it, but it turns out that these claims of hacks and benign disingenuity amount to something so small that I would call it nothing (albeit, a very clever nothing).</p>
<p>Who am I to say such a thing? Well, I have data, lovingly provided by the labors or a small ruby script and the Hpricot gem. By my count, most of pg&#8217;s statements do not require any great degree of rhetorical aid, as implied by <a href="http://jsomers.net/blog/it-turns-out">this analysis</a> (which, despite my disagreement, is excellently written). Take a look for yourself (and pardon the potentially regex-induced typos):</p>
<blockquote><p>From: http://www.paulgraham.com/angelinvesting.html<br />
When we sold our startup in 1998 I thought one day I&#8217;d do some angel investing.  Seven years later I still hadn&#8217;t started.  I put it off because it seemed mysterious and complicated.   It <span style="color: red;">turns out</span> to be  easier than I expected, and also more interesting.The part I thought was hard, the mechanics of investing, really isn&#8217;t. You give a startup money and they give you stock.  You&#8217;ll probably get either preferred stock, which means stock with extra rights like getting your money back fir&#8230;</p>
<p>From: http://www.paulgraham.com/hackernews.html<br />
&#8230;g ideas in the future, and the ones that turn out to work will probably seem just as broken as those that don&#8217;t.Probably the most important thing I&#8217;ve learned about dilution is that it&#8217;s measured more in behavior than users. It&#8217;s bad behavior you want to keep out more than bad people. User behavior <span style="color: red;">turns out</span> to be surprisingly malleable.  If people are  expected to behave well, they tend to; and vice versa.Though of course forbidding bad behavior does tend to keep away bad people, because they feel uncomfortably constrained in a place where they have to behave well.  But this way of keeping the&#8230;</p>
<p>From: http://www.paulgraham.com/highres.html<br />
&#8230;mously successful organizations like the Roman army or the British East India Company were any less afflicted by protocol and politics than organizations of the same size today. But they were competing against opponents who couldn&#8217;t change the rules on the fly by discovering new technology.  Now it <span style="color: red;">turns out</span> the rule &#8220;large and disciplined organizations win&#8221; needs to have a qualification appended: &#8220;at games that change slowly.&#8221; No one knew till change reached a sufficient speed.Large organizations will start to do worse now, though, because for the first time in history they&#8217;re no longer gettin&#8230;</p>
<p>From: http://www.paulgraham.com/cities.html<br />
&#8230; It&#8217;s probably the place in America where someone from Northern Europe would feel most at home.  But it&#8217;s not humming with ambition.In retrospect it shouldn&#8217;t have been surprising that a place so pleasant would attract people interested above all in quality of life.  Cambridge with good weather, it <span style="color: red;">turns out</span>, is not Cambridge. The people you find in Cambridge are not there by accident.  You have to make sacrifices to live there.  It&#8217;s expensive and somewhat grubby, and the weather&#8217;s often bad.  So the kind of people you find in Cambridge are the kind of people who want to live where the smartes&#8230;</p>
<p>From: http://www.paulgraham.com/distraction.html<br />
&#8230;owse the web.  (Irony of ironies, it&#8217;s the computer Steve Huffman wrote Reddit on.  When Steve and Alexis auctioned off their old laptops for charity, I bought them for the Y Combinator museum.)My rule is that I can spend as much time online as I want, as long as I do it on that computer.  And this <span style="color: red;">turns out</span> to be enough.  When I have to sit on the other side of the room to check email or browse the web, I become much more aware of it.  Sufficiently aware, in my case at least, that it&#8217;s hard to spend more than about an hour a day online.And my main computer is now freed for work.  If you try th&#8230;</p>
<p>From: http://www.paulgraham.com/good.html<br />
&#8230; truth you don&#8217;t have to remember anything, and that&#8217;s a really useful property in domains where things happen fast.For example, Y Combinator has now invested in 80 startups, 57 of which are still alive.  (The rest have died or merged or been acquired.)  When you&#8217;re trying to advise 57 startups, it <span style="color: red;">turns out</span> you have to have a stateless algorithm.  You can&#8217;t have ulterior motives when you have 57 things going on at once, because you can&#8217;t remember them.  So our rule is just to do whatever&#8217;s best for the founders.  Not because we&#8217;re particularly benevolent, but because it&#8217;s the only algorithm th&#8230;</p>
<p>From: http://www.paulgraham.com/philosophy.html<br />
&#8230;s examples of how to argue: they hoped they were getting results.  Most were wrong, but it doesn&#8217;t seem an impossible hope.This argument seems to me like someone in 1500 looking at the lack of results achieved by alchemy and saying its value was as a process. No, they were going about it wrong.  It <span style="color: red;">turns out</span> it is possible to transmute lead into gold (though not economically at current energy prices), but the route to that knowledge was to backtrack and try another approach.Thanks to Trevor Blackwell, Paul Buchheit, Jessica Livingston,  Robert Morris, Mark Nitzberg, and Peter Norvig for reading&#8230;</p>
<p>From: http://www.paulgraham.com/colleges.html<br />
&#8230;is was the new trend of worrying obsessively about what  kindergarten your kids go to.  It seemed to me this couldn&#8217;t possibly matter.  Either it won&#8217;t help your kid get into Harvard, or if it does, getting into Harvard won&#8217;t mean much anymore.  And then I thought: how much does it mean even now?It <span style="color: red;">turns out</span> I have a lot of data about that.  My three partners and I run a seed stage investment firm called  Y Combinator.  We invest when the company is just a couple guys and an idea.  The idea doesn&#8217;t matter much; it will change anyway.  Most of our decision is based on the founders.  The average &#8230;</p>
<p>From: http://www.paulgraham.com/head.html<br />
&#8230;t possible.Probably the best we&#8217;ll do is some kind of hack, like making the programming parts of an organization work differently from the rest. Perhaps the optimal solution is for big companies not even to try to develop ideas in house, but simply to  buy them.  But regardless of what the solution <span style="color: red;">turns out</span> to be, the first step is to realize there&#8217;s a problem.  There is a contradiction in the very phrase &#8220;software company.&#8221;   The two words are pulling in opposite directions. Any good programmer in a large organization is going to be at odds with it, because organizations are designed to preve&#8230;</p>
<p>From: http://www.paulgraham.com/wisdom.html<br />
&#8230;adicts them.Is the mathematician a small man because he&#8217;s discontented?  No; he&#8217;s just doing a kind of work that wasn&#8217;t very common in Confucius&#8217;s day.Human knowledge seems to grow fractally.  Time after time, something that seemed a small and uninteresting area—experimental error, even—<span style="color: red;">turns out</span>, when examined up close, to have as much in it as all knowledge up to that point.  Several of the fractal buds that have exploded since ancient times involve inventing and discovering new things.  Math, for example, used to be something a handful of people did part-time.  Now it&#8217;s the caree&#8230;</p>
<p>From: http://www.paulgraham.com/goodart.html<br />
&#8230;itional//EN&#8221;&gt;  How Art Can Be Good  December 2006I grew up believing that taste is just a matter of personal preference. Each person has things they like, but no one&#8217;s preferences are any better than anyone else&#8217;s.  There is no such thing as good taste.Like a lot of things I grew up believing, this <span style="color: red;">turns out</span> to be false, and I&#8217;m going to try to explain why.One problem with saying there&#8217;s no such thing as good taste is that it also means there&#8217;s no such thing as good art.  If there were good art, then people who liked it would have better taste than people who didn&#8217;t.  So if you discard taste, y&#8230;</p>
<p>From: http://www.paulgraham.com/mit.html<br />
&#8230;personal bias points in the same direction technology evolves in.The advantages of rootlessness are similar to those of poverty. When you&#8217;re young you&#8217;re more mobile—not just because you don&#8217;t have a house or much stuff, but also because you&#8217;re less likely to have serious relationships.  This <span style="color: red;">turns out</span> to be important, because a lot of startups involve someone moving.The founders of Kiko, for example, are now en route to the Bay Area to start their next startup.  It&#8217;s a better place for what they want to do.  And it was easy for them to decide to go, because neither as far as I know has a&#8230;</p>
<p>From: http://www.paulgraham.com/marginal.html<br />
&#8230; comics  might seem to the average person today.In the computer world we get not new mediums but new platforms: the minicomputer, the microprocessor, the web-based application.  At first they&#8217;re always dismissed as being unsuitable for real work. And yet someone always decides to try anyway, and it <span style="color: red;">turns out</span> you can do more than anyone expected.  So in the future when you hear people say of a new platform: yeah, it&#8217;s popular and cheap, but not ready yet for real work, jump on it.As well as being more comfortable working on established lines, insiders generally have a vested interest in perpetua&#8230;</p>
<p>From: http://www.paulgraham.com/america.html<br />
&#8230;upation&#8211; which is not far from the idea that each person has a natural &#8220;station&#8221; in life.  If this were true, the most efficient plan would be to discover each person&#8217;s station as early as possible, so they could receive the training appropriate to it.In the US things are more haphazard.  But that <span style="color: red;">turns out</span> to be an advantage as an economy gets more liquid, just as dynamic typing <span style="color: red;">turns out</span> to work better than static for ill-defined problems.  This is particularly true with startups.  &#8220;Startup founder&#8221; is not the sort of career a high school student would choose.  If you ask at that age, people&#8230;</p>
<p>From: http://www.paulgraham.com/randomness.html<br />
&#8230;e would.  We&#8217;d ask why we even suppose we have a &#8220;purpose&#8221; in life. We may be better adapted for some things than others; we may be happier doing things we&#8217;re adapted for; but why assume purpose?The history of ideas is a history of gradually discarding the assumption that it&#8217;s all about us.  No, it <span style="color: red;">turns out</span>, the earth is not the center of the universe—not even the center of the solar system.  No, it <span style="color: red;">turns out</span>, humans are not created by God in his own image; they&#8217;re just one species among many, descended not merely from apes, but from microorganisms.  Even the concept of &#8220;me&#8221; <span style="color: red;">turns out</span> to&#8230;</p>
<p>From: http://www.paulgraham.com/startupfunding.html<br />
&#8230; a loan that can be converted into stock later; it works out the same as a stock purchase in the end, but gives the angel more protection against being squashed by VCs in future rounds.Who pays the legal bills for this deal?  The startup, remember, only has a couple thousand left.  In practice this <span style="color: red;">turns out</span> to be a sticky problem that usually gets solved in some improvised way. Maybe the startup can find lawyers who will do it cheaply in the hope of future work if the startup succeeds.  Maybe someone has a lawyer friend.  Maybe the angel pays for his lawyer to represent both sides.  (Make sure&#8230;</p>
<p>From: http://www.paulgraham.com/ideas.html<br />
&#8230;enomenon when I worked on spam filters.  In 2002, most people preferred to ignore spam, and most of those who didn&#8217;t preferred to believe the heuristic filters then available were the best you could do.I found spam intolerable, and I felt it had to be possible to recognize it statistically.  And it <span style="color: red;">turns out</span> that was all you   needed to solve the problem.  The algorithm I used was ridiculously simple.  Anyone who&#8217;d really tried to solve the problem would have found it.  It was just that no one had really tried to solve the problem. [3]Let me repeat that recipe: finding the problem intolerable a&#8230;</p>
<p>From: http://www.paulgraham.com/inequality.html<br />
&#8230; confiscate whatever you deem to be surplus.So let&#8217;s be clear what reducing economic inequality means.  It is    identical with taking money from the rich.When you transform a mathematical expression into another form, you often notice new things.  So it is in this case.  Taking money from the rich <span style="color: red;">turns out</span> to have consequences one might not foresee when one phrases the same idea in terms of &#8220;reducing inequality.&#8221;The problem is, risk and reward have to be proportionate.  A bet   with only a 10% chance of winning has to pay more than one with a 50% chance of winning, or no one will take it.  So&#8230;</p>
<p>From: http://www.paulgraham.com/opensource.html<br />
&#8230;can I claim business has to learn it?  When I say business doesn&#8217;t know this, I mean the structure of business doesn&#8217;t reflect it.Business still reflects an older model, exemplified by the French word for working: travailler.  It has an English cousin, travail, and what it means is torture. [2]This <span style="color: red;">turns out</span> not to be the last word on work, however. As societies get richer, they learn something about work that&#8217;s a lot like what they learn about diet.  We know now that the healthiest diet is the one our peasant ancestors were forced to eat because they were poor.  Like rich food, idleness only s&#8230;</p>
<p>From: http://www.paulgraham.com/submarine.html<br />
&#8230; came from.  I could tell a lot of them were crap, but I didn&#8217;t realize why.Remember the exercises in critical reading you did in school, where you had to look at a piece of writing and step back and ask whether the author was telling the whole truth?  If you really want to be a critical reader, it <span style="color: red;">turns out</span> you have to step back one step further, and ask not just whether the author is telling the truth, but why he&#8217;s writing about this subject at all.Online, the answer tends to be a lot simpler.  Most people who publish online write what they write for the simple reason that they want to.  You &#8230;</p>
<p>From: http://www.paulgraham.com/bronze.html<br />
&#8230; a field like that would be dominated by fearsome startups with five million dollars of VC money each.  Whereas we felt pretty sure that we could hold our own in the slightly less competitive business of generating Web sites  for art galleries.We erred ridiculously far on the side of safety.  As it <span style="color: red;">turns out</span>, VC-backed startups are not that fearsome.  They&#8217;re too busy trying to spend all that  money to get software written.  In 1995, the e-commerce business was very competitive as measured in press releases, but not as measured in software.  And really it never was.  The big fish like Open Mark&#8230;</p>
<p>From: http://www.paulgraham.com/venturecapital.html<br />
&#8230;rcentage of the gains.  So they want the fund to be huge&#8211; hundreds of millions of dollars, if possible. But that means each partner ends up being responsible for investing a lot of money.  And since one person can only manage so many deals, each deal has to be for multiple millions of dollars.This <span style="color: red;">turns out</span> to explain nearly all the characteristics of VCs that founders hate.It explains why VCs take so agonizingly long to make up their minds, and why their due diligence feels like a body cavity search. [2] With so much at stake, they have to be paranoid.It explains why they steal your ideas.  E&#8230;</p>
<p>From: http://www.paulgraham.com/start.html<br />
&#8230;corporating it, of course: insurance, business license, unemployment compensation,     various things with the IRS.  I&#8217;m not even sure what the list is, because we, ah, skipped all that.  When we got real funding near the end of 1996, we hired a great CFO, who fixed everything    retroactively.  It <span style="color: red;">turns out</span> that no one comes and arrests you if you don&#8217;t do everything you&#8217;re supposed to when starting a company. And a good thing too, or a lot of startups would never get started. [5]It can be dangerous to delay turning yourself into a company, because one or more of the founders might decide to s&#8230;</p>
<p>From: http://www.paulgraham.com/hs.html<br />
&#8230;s to learn what the options were.  You don&#8217;t need to be in a rush to choose your life&#8217;s work.  What you    need to do is discover what you like.  You have to work on stuff   you like if you want to be good at what you do.It might seem that nothing would be easier than deciding what you like, but it <span style="color: red;">turns out</span> to be hard, partly because it&#8217;s hard to get an accurate picture of most jobs.  Being a doctor is not the way it&#8217;s portrayed on TV.  Fortunately you can also watch real doctors, by volunteering in hospitals. [1]But there are other jobs you can&#8217;t learn about, because no one is doing them yet&#8230;.</p>
<p>From: http://www.paulgraham.com/laundry.html<br />
&#8230;turned    against them by clumsy, self-appointed tour guides. The other big difference between a real essay and the  things they make you write in school is that a real essay doesn&#8217;t  take a position and then defend it.  That principle, like the idea that we ought to be writing about literature,    <span style="color: red;">turns out</span> to be another intellectual hangover of long forgotten origins.  It&#8217;s often mistakenly believed that medieval universities were mostly seminaries.  In fact they were more law schools.  And at least in our tradition lawyers are advocates: they are trained to be able to take either side of an &#8230;</p>
<p>From: http://www.paulgraham.com/bubble.html<br />
&#8230;ing happened during the Mississippi and South Sea Bubbles. What drove them was the invention of organized public finance (the South Sea Company, despite its name, was really a competitor of the Bank of England).  And that did turn out to be a big deal, in the long run.Recognizing an important trend <span style="color: red;">turns out</span> to be easier than  figuring out how to profit from it.  The mistake investors always seem to make is to take the trend too literally. Since the Internet was the big new thing, investors supposed that the more Internettish the company, the better.  Hence such parodies as Pets.Com.In fact mos&#8230;</p>
<p>From: http://www.paulgraham.com/essay.html<br />
&#8230;was, 700 years ago, fascinating and urgently needed work.No DefenseThe other big difference between a real essay and the things they make you write in school is that a real essay doesn&#8217;t take a position and then defend it.  That principle, like the idea that we ought to be writing about literature, <span style="color: red;">turns out</span> to be another intellectual hangover of long forgotten origins.It&#8217;s often mistakenly believed that medieval universities were mostly seminaries.  In fact they were more law schools.  And at least in our tradition lawyers are advocates, trained to take either side of an argument and make as g&#8230;</p>
<p>From: http://www.paulgraham.com/gh.html<br />
&#8230;ket.  What VCs should be looking for is the next Apple, or the next Google.I think Bill Gates knows this.  What worries him about Google is not the power of their brand, but the fact that they have better hackers. [7] RecognitionSo who are the great hackers?  How do you know when you meet one? That <span style="color: red;">turns out</span> to be very hard.  Even hackers can&#8217;t tell.  I&#8217;m pretty sure now that my friend Trevor Blackwell is a great hacker. You may have read on Slashdot how he made his  own Segway.  The remarkable thing about this project was that he wrote all the software in one day (in Python, incidentally).For &#8230;</p>
<p>From: http://www.paulgraham.com/wealth.html<br />
&#8230;he    difficulty of assigning a value to each person&#8217;s work.  For the most part they punt.  In a big company you get paid a fairly predictable salary for working  fairly hard.  You&#8217;re expected not to be obviously incompetent or lazy, but you&#8217;re not expected to devote your whole life to your work.It <span style="color: red;">turns out</span>, though, that there are economies of scale in how much of your life you devote to your work.  In the right kind of business,   someone who really devoted himself to work could generate ten or even a hundred times as much wealth as an average employee.  A programmer, for example, instead of &#8230;</p>
<p>From: http://www.paulgraham.com/gba.html<br />
&#8230;pt countries become poor; and poor countries are weak.  It seems to me there is a Laffer curve for government power, just as for tax revenues.  At least, it seems likely enough that it would be stupid to try the experiment and find out.  Unlike high tax rates, you can&#8217;t repeal totalitarianism if it <span style="color: red;">turns out</span> to be a mistake.This is why hackers worry.  The government spying on people doesn&#8217;t literally make programmers write worse code.  It just leads eventually to a world in which bad ideas win.  And because this is so important to hackers, they&#8217;re especially sensitive to it.  They can sense tot&#8230;</p>
<p>From: http://www.paulgraham.com/hp.html<br />
&#8230;eers figure out how to do it.What and how should not be kept too separate.  You&#8217;re asking for trouble if you try to decide what to do without understanding how to do it. But hacking can certainly be more than just deciding how to implement some spec.  At its best, it&#8217;s creating the spec&#8211; though it <span style="color: red;">turns out</span> the best way to do that is to implement it.Perhaps one day &#8220;computer science&#8221; will, like Yugoslavia, get broken up into its component parts.  That might be a good thing.  Especially if it meant independence for my native land, hacking.Bundling all these different types of work together in o&#8230;</p>
<p>From: http://www.paulgraham.com/spam.html<br />
&#8230;l analysis, I found immediately that it was much cleverer than I had been. It discovered, of course, that terms like &#8220;virtumundo&#8221; and &#8220;teens&#8221; were good indicators of spam.  But it also discovered that &#8220;per&#8221; and &#8220;FL&#8221; and &#8220;ff0000&#8243; are good  indicators of spam.  In fact, &#8220;ff0000&#8243; (html for bright red) <span style="color: red;">turns out</span> to be as good an indicator of spam as any   pornographic term._ _ _Here&#8217;s a sketch of how I do statistical filtering.  I start with one corpus of spam and one of nonspam mail.  At the moment each one has about 4000 messages in it.  I scan the entire text, including headers and embedded html&#8230;</p>
<p>From: http://www.paulgraham.com/icad.html<br />
&#8230;at also means there will always be lots of Java programmers, so if the programmers working for me now quit, as programmers working for me mysteriously always do, I can easily replace them.Well, this doesn&#8217;t sound that unreasonable.  But it&#8217;s all based on one unspoken assumption, and that assumption <span style="color: red;">turns out</span> to be false.  The pointy-haired boss believes that all programming languages are pretty much equivalent. If that were true, he would be right on target.  If languages are all equivalent, sure, use whatever  language everyone else is using.But all languages are not equivalent, and I think I &#8230;</p>
<p>From: http://www.paulgraham.com/road.html<br />
&#8230;an of any loose objects that might later get stuck in something.It helps if you use a technique called functional programming. Functional programming means avoiding side-effects.  It&#8217;s something you&#8217;re more likely to see in research papers than commercial software, but for Web-based applications it <span style="color: red;">turns out</span> to be really useful.  It&#8217;s hard to write entire programs as purely functional code, but you can write substantial chunks this way.  It makes those parts of your software easier to test, because they have no state, and that is very convenient in a situation where you are constantly making an&#8230;</p>
<p>From: http://www.paulgraham.com/javacover.html<br />
&#8230;ught customers would want, or something they were told to do by management.  These are smart people; if the technology was good, they&#8217;d have used it voluntarily.6. It has too many cooks.  The best programming languages have been developed by small groups.  Java seems to be run by a committee. If it <span style="color: red;">turns out</span> to be a good language, it will be the first time in history that a committee has designed a good language.7. It&#8217;s bureaucratic.  From what little I know about Java, there seem to be a lot of protocols for doing things.  Really good languages aren&#8217;t like that.  They let you do what you want &#8230;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.ethanjfast.com/2010/03/as-it-turns-out-is-quite-innocuous/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gajure Now on Clojars</title>
		<link>http://blog.ethanjfast.com/2010/02/gajure-now-on-clojars/</link>
		<comments>http://blog.ethanjfast.com/2010/02/gajure-now-on-clojars/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 18:39:03 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Clojure]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Gajure]]></category>
		<category><![CDATA[Genetic Algorithms]]></category>

		<guid isPermaLink="false">http://blog.ethanjfast.com/?p=351</guid>
		<description><![CDATA[Gajure, my small genetic algorithm framework, is now up on Clojars. Hopefully, this should make it much more convenient to use in a real project. I also added Leiningen support, and if you use Clojure with any frequency, I&#8217;d recommend checking that out.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/Ejhfast/Gajure">Gajure</a>, my small genetic algorithm framework, is now up on <a href="http://clojars.org/gajure">Clojars</a>. Hopefully, this should make it much more convenient to use in a real project. I also added <a href="http://github.com/technomancy/leiningen">Leiningen</a> support, and if you use Clojure with any frequency, I&#8217;d recommend checking that out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ethanjfast.com/2010/02/gajure-now-on-clojars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Police Pursue and Capture a Barefoot Runner</title>
		<link>http://blog.ethanjfast.com/2010/02/police-pursue-and-capture-a-barefoot-runner/</link>
		<comments>http://blog.ethanjfast.com/2010/02/police-pursue-and-capture-a-barefoot-runner/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 03:46:04 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Barefoot Running]]></category>
		<category><![CDATA[Writing]]></category>
		<category><![CDATA[police]]></category>
		<category><![CDATA[running]]></category>

		<guid isPermaLink="false">http://blog.ethanjfast.com/?p=321</guid>
		<description><![CDATA[I went running today. In and of itself, this is far from unusual, and indeed, I go running most days. Something else happened, however, a deep and dark and disturbing something. Today on my run I was detained by the police, forced to enter an officer&#8217;s vehicle, and &#8220;escorted&#8221; back to my  apartment. I was [...]]]></description>
			<content:encoded><![CDATA[<p>I went running today. In and of itself, this is far from unusual, and indeed, I go running most days. Something else happened, however, a deep and dark and disturbing something. Today on my run I was detained by the police, forced to enter an officer&#8217;s vehicle, and &#8220;escorted&#8221; back to my  apartment. I was assumed to be mentally unstable, on drugs, and perhaps both.</p>
<p>Now, what kind of runner must bear this hideous burden of proof? To be presumed crazy before sane, and intoxicated before clean? What kind of runner is dragged off his joyous release of energy on the streets and trails of his neighborhood? Well, apparently a barefoot one.</p>
<p>Granted, these policemen &#8211; these unwanted and would-be protectors of my person &#8212; they did have something going for them. It was 35 degrees outside. Snow lay piled in banks along the sidewalks and road-corners. Yet there I was, this strange young man in running shorts and a sweatshirt, leaping over and atop piles of snow, padding gracefully down ice-encrusted sidewalks. Without shoes. It must have been clear to them, and to the logic of their misplaced assumptions: surely, no sane person would be engaging in such pursuits.</p>
<p>Well, they were wrong. Their premises were wrong. This did not, of course, prevent them from taking control of the situation. Alas, it was a tragedy in which all parties were confused. At first, I thought the officers were being friendly in that ignorant way with which I am so intimately familiar. I&#8217;ve been offered rides by many strangers, and apparently the local assumption is that I&#8217;m some kind of poor lost kitten, in need of help on his journey home.</p>
<p>So as they pulled over and cracked the door of their police car, I smiled and waved them off. &#8220;No, I&#8217;m fine,&#8221; I said. &#8220;I&#8217;m <em>running!&#8221; </em>In retrospect, they did seem more determined then one&#8217;s average do-gooder, but to my peril, I did not notice this at the time.</p>
<p>&#8220;Wait,&#8221; they called.</p>
<p>&#8220;I&#8217;m fine,&#8221; I repeated. As I passed away and forward, they shouted once more at me to come back, and I miscalculated by ignoring this as well &#8212; by speeding up, in fact.</p>
<p>So it was that I entered the short &#8212; and as things would end up, final &#8212; stretch of my run. A bit of a race with a police car, as it were, although strictly speaking this was not really intended. Stupidly, I thought the officers would give up their offers of uninformed aid when they noticed my obvious competence (I can go fast, you see) and unambiguous obstinacy. But I, too, was operating under misassumptions. These officers were not playing in the mental zone of the good samaritan, but rather that more enticing arena of <em>catch and subdue the crazy person.</em></p>
<p>In the end there was no subduing. Upon a second rendezvous, the motives of the officers were quite apparent, and I quickly complied, although only against the risks and uncertainties of my alternatives. In the end, what I needed was someone to vouch for me, a duty that my roommate happily performed. And so it was that the exalted release which I normally gain from running transformed into a proverbial slap in the face, a gift from those friends of misunderstood culture.</p>
<p>But this was not all. I was provided with a card that I would do well to keep with me upon all my runs, such that I might &#8220;prove myself&#8221; to other officers. The compassion! Inexperienced as I am, I&#8217;ll offer this (half-serious) warning to cold weather barefoot runners: you are being hunted; travel in packs.</p>
<p><em> </em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ethanjfast.com/2010/02/police-pursue-and-capture-a-barefoot-runner/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>On Initiative</title>
		<link>http://blog.ethanjfast.com/2010/02/on-initiative/</link>
		<comments>http://blog.ethanjfast.com/2010/02/on-initiative/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 15:59:45 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Writing]]></category>
		<category><![CDATA[initiative]]></category>
		<category><![CDATA[startups]]></category>
		<category><![CDATA[success]]></category>

		<guid isPermaLink="false">http://blog.ethanjfast.com/?p=305</guid>
		<description><![CDATA[This past week, I&#8217;ve been thinking quite a bit about success. Now, perhaps this is a somewhat pedantic exercise, but it seems that if I would like to be successful (and I assure you, this is a valid premise), then I ought to better understand the term &#8212; what it means, what it implies, and [...]]]></description>
			<content:encoded><![CDATA[<p>This past week, I&#8217;ve been thinking quite a bit about success. Now, perhaps this is a somewhat pedantic exercise, but it seems that if I would like to be successful (and I assure you, this is a valid premise), then I ought to better understand the term &#8212; what it means, what it implies, and most importantly, how this meaning achieves instantiation.</p>
<p>Most people would agree, I think, that there are many ways to succeed, and a nearly infinite number of things upon which such success can be centered. But what does this mean? After all, a successful father is quite different from a successful businessmen, and yet &#8220;success&#8221; can be used, quite appropriately, to describe each. This is not a hard question; at first brush, the answer seems obvious. In each instance, a goal was set &#8212; meaningful fatherhood, or growing a business &#8211; and likewise, in each instance the particulars of a goal were achieved.</p>
<p>But is that all there is to success, the fulfillment of goals? It seems unlikely that an incarcerated man would consider the fulfilling of his imprisonment a successful endeavor. Clearly, there must be a subjective side to the term. To be successful at something, one must desire it. So success requires at least two things: a goal and a desire. Take either away, and you destroy its meaning. Consider the hypothetical beneficiary of vast and unexpected charity. She had no pans to acquire wealth, and so she is no more successful than our aforementioned prisoner, even if she counted money among her desires. Without a goal in place, its achievement means nothing.</p>
<p>Now, all this is quite obvious and boring; one might suggest that it&#8217;s just a quick and poor deconstruction of semantics. The real and practical question is whether all unique instances of success stem from any common source. Effectively, one might ask, among all the disparate successes of the world, do they have anything in common? Can the businessman and the father &#8212; at the most general of levels &#8212; share a common game plan? I would argue that they can, and that they do. Moreover, I think this common element is initiative.</p>
<p>Certainly, when starting a business, initiative plays an integral role. Every company in present existence required, at minimum, the initiative of creation, the actions of a prime mover who would set it up to succeed (or fail), as history will dictate. But more than this, there is a broader sense in which initiative is tied to the founding of companies. Businesses are started, and markets created, to meet the needs of a particular consumer base. Identifying that need, or alternatively, improving upon the realization of an existing need, by definition requires initiative. It necessitates a <em>seeing thorough</em> of reality, a questioning of what is, and the recognition of a world that might be.</p>
<p>Success in science, too, is bound up in initiative. Scientific research explores the undiscovered territory of human knowledge. It takes initiative to make that first step into the dark, to decide where to place one&#8217;s efforts, and to question and improve upon the current state of knowledge. Moreover, the grand revolutions of science are steeped in such character. I doubt it needs mentioning, but Einstein&#8217;s discovery of special relativity occurred while he was a patent clerk &#8212; that&#8217;s clearly initiative, if ever any has existed.</p>
<p>But what about the father, and those softer definitions of success? Here particularly, my argument can be seen to break down on some boundary cases. Take, for example, a rich and carefree fellow who has as his &#8220;fatherly&#8221; desire and goal: <em>my children shall not starve</em>. Well, even though by his own definition he is successful, it&#8217;s hard to see such a person as displaying initiative. But this, I think, is a special case. For most people, in most circumstances, the goals by which they characterize success are achieved by standards outside of their personal norm. And almost by definition, if a goal is difficult to achieve, then one might benefit from the application of initiative. After all, if it&#8217;s easy to acquire something without any initiative whatsoever, you probably have it already.</p>
<p>So, one might say I&#8217;m rather a fan of initiative &#8212; at least, as far as achieving success is concerned.  Yet strangely, most people that I talk to don&#8217;t hold the same opinion. I&#8217;ll ask them how they think most people succede, and the answers are usually <em>intelligence</em>, <em>dedication</em>, or perhaps, <em>luck</em>. All these things surely play a role in success, but, in my humble view, they are not the <em>prime move</em>r of successful endeavors &#8212; no, that role is played by initiative.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ethanjfast.com/2010/02/on-initiative/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I develop on OSX</title>
		<link>http://blog.ethanjfast.com/2010/02/why-im-dumb-or-how-i-develop-on-osx/</link>
		<comments>http://blog.ethanjfast.com/2010/02/why-im-dumb-or-how-i-develop-on-osx/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 02:06:20 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Package Management]]></category>
		<category><![CDATA[Snow Leopard]]></category>

		<guid isPermaLink="false">http://blog.ethanjfast.com/?p=276</guid>
		<description><![CDATA[It recently occurred to me that I&#8217;m dumb. I certainly don&#8217;t mean this in any pejorative sense (after all, that would be abrasive to the ego), but rather I would suggest it as regards a behavioral pattern that I tend to follow. Roughly, said pattern goes like this:

Identify problem
On the grounds of theoretical purity, construct needlessly complicated solution.
Implement solution.

For [...]]]></description>
			<content:encoded><![CDATA[<p>It recently occurred to me that I&#8217;m dumb. I certainly don&#8217;t mean this in any pejorative sense (after all, that would be abrasive to the ego), but rather I would suggest it as regards a behavioral pattern that I tend to follow. Roughly, said pattern goes like this:</p>
<ol>
<li>Identify problem</li>
<li>On the grounds of theoretical purity, construct needlessly complicated solution.</li>
<li>Implement solution.</li>
</ol>
<p>For instance, a few days ago I wanted to put together a small rails application. There was nothing earth shattering in this; I simply wanted to get a quick prototype up and running. So I update my gems, do a quick `rails prototype/` command, and boot up the empty app. It fails.</p>
<p>Ok, so I do the natural thing; I google the error message or whatnot; I search for a few minutes. Well, it has something to do with Snow Leopard, that much becomes clear. This begs the question: does any bug ever <em>not</em> have something to do with Snow Leopard? But I won&#8217;t adress that here. Anyhow, there is an obscure solution, under which I&#8217;d have to edit manually my rails installation &#8212; something like that, anyway.  But I&#8217;m not going to do that. I try some earlier versions of rails and it&#8217;s dependancies &#8212; they fail for some other reasons.</p>
<p>I&#8217;m sure that I could have figured it out, had I dug around for a while. I might have, with work, discovered the vagaries behind why the same programs, with the same (nominally) installed dependancies exhibited opposite behaviors on different machines. But no, by next month I&#8217;d probably just have a new and similar problem. So I do just what any irrational fellow ought to; I decide to install a virtual Arch distro (my favorite) with VMware fusion, mount the machine as a disk via ssh, and develop from there. At least in Arch, I will know exactly what is installed, where it is, and how it ought to be working. Basically, I eliminate the free variable of imprecise ignorance regarding everything that&#8217;s on the machine, and whether I&#8217;ve hacked it up manually. Of course, god forbid that I give up TextMate and actually code directly on a linux machine. Emacs is awesome for my more lispy projects, but I like TM for rails.</p>
<p>To be clear, the blame here is almost entirely on me. However, given the recent announcement of  the iPad, I feel that it&#8217;s become the custom to lay down some hate. So here goes: Apple, you ought to implement a decent <a href="http://blog.ethanjfast.com/2009/10/osx-package-management/">package management</a> scheme. Some inconsistency with something I had installed (or worse, <em>you</em> put there) was messing things up. Sure, one might say that I use pacman (or yum, or <em>insert-reader-favorite</em>) as a crutch, and I&#8217;m fine with that. In particular, said management helps prevent people like me &#8212; overly exuberant installers and occasional hackers of who-knows-what &#8211; from messing up systems.</p>
<p>So on the one hand, I get what I want. Things tend to work on Arch, and updating is only a `pacman -Syu` away. On the other hand &#8212; yeah, I&#8217;m dumb.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ethanjfast.com/2010/02/why-im-dumb-or-how-i-develop-on-osx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Tweeting Narcissist</title>
		<link>http://blog.ethanjfast.com/2009/12/the-tweeting-narcissist/</link>
		<comments>http://blog.ethanjfast.com/2009/12/the-tweeting-narcissist/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 22:34:47 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[sinatra]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[web application]]></category>

		<guid isPermaLink="false">http://blog.ethanjfast.com/?p=261</guid>
		<description><![CDATA[I&#8217;ve been playing a bit with the Sinatra web framework, and after some intermittent coding, I ended up with a toy project I&#8217;m calling the Narcissist Quotient. It may seem that I&#8217;m poking fun at of Twitter&#8217;s ego-centric bent, and perhaps this is true. It is equally possible, however, that my design is to satirize [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing a bit with the <a href="http://www.sinatrarb.com/">Sinatra</a> web framework, and after some intermittent coding, I ended up with a toy project I&#8217;m calling the <a href="http://narcissist.ethanjfast.com">Narcissist Quotient</a>. It may seem that I&#8217;m poking fun at of Twitter&#8217;s ego-centric bent, and perhaps this is true. It is equally possible, however, that my design is to satirize those who boisterously lament &#8220;the rampant self-absorption&#8221; instilled through today&#8217;s technologies. I&#8217;ll leave the verdict up to the reader.</p>
<p>As always, the code open source and available at <a href="http://github.com/Ejhfast/Narcissist">github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ethanjfast.com/2009/12/the-tweeting-narcissist/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Clojure :pre and :post</title>
		<link>http://blog.ethanjfast.com/2009/12/clojure-pre-and-post/</link>
		<comments>http://blog.ethanjfast.com/2009/12/clojure-pre-and-post/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 14:54:11 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Clojure]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Gajure]]></category>
		<category><![CDATA[Genetic Algorithms]]></category>

		<guid isPermaLink="false">http://blog.ethanjfast.com/?p=248</guid>
		<description><![CDATA[Courtesy of Hacker News, this morning I stumbled upon a blog post mentioning :pre and :post assertions, a new feature in version 1.1 of Clojure. Given the rather messy nature of several functions in Gajure (my toy genetic algorithm framework), it seemed to me that I had an ideal opportunity to make use of this [...]]]></description>
			<content:encoded><![CDATA[<p>Courtesy of Hacker News, this morning I stumbled upon a <a href="http://blog.fogus.me/2009/12/21/clojures-pre-and-post/">blog post</a> mentioning :pre and :post assertions, a new feature in version 1.1 of Clojure. Given the rather messy nature of several functions in <a href="http://github.com/Ejhfast/Gajure">Gajure</a> (my toy genetic algorithm framework), it seemed to me that I had an ideal opportunity to make use of this new functionality.</p>
<p>For instance, although the function <em>run-ga</em> only takes two parameters, both of them are hashes. Naturally, each must contain a few keys for the genetic algorithm to run properly. Using preconditions, it&#8217;s easy to ensure that the function&#8217;s parameters contain these required keys. For instance:</p>
<pre>
(defn keys-not-nil [lst hash]
  (reduce #(and %1 %2) (map #(not (nil? (hash %))) lst)))
</pre>
<p>This checks each key in a list of keys, and returns false if one or more of these keys maps to a value of nil. Obviously, I could go further here, but checking for non-nil values seemed a reasonable (and easy) generalization (e.g. if <em>:init-fn</em> or <em>:mut-r</em> map to nil, then the <em>ga-run</em> function will have a problem). Now, making use of the :pre tag.</p>
<pre>
(defn run-ga
[func-map setting-map]
{:pre [(and
  (keys-not-nil
    (list :init-fn :fit-fn :mut-fn :sel-fn :cross-fn)
    func-map)
  (keys-not-nil
    (list :pop-sz :gen :children :mut-r)
    setting-map))]}
... actual algorithm ...)
</pre>
<p>So I can now enforce the (arbitrary) required keys, and return assertion errors on some improper uses of <em>ga-run</em>. For a more specific example, look to the algorithm&#8217;s mutation function.</p>
<pre>
(defn generic-mutation
  "Randomly mutates lists with elements from other lists in the population."
  [list prob]
  {:pre [(and (>= prob 1) (<= prob 100))]
   :post [(list? %)]}
  (map
   (fn [s-list]
     (map
      (fn [test]
        (if (> prob (rand-int 100))
          (let [r-s (rand-int (count list))
                r-t (rand-int (count (nth list r-s)))]
            (nth (nth list r-s)
                 r-t))
          test))
      s-list))
   list))
</pre>
<p>Here, the :pre tag ensures that the value of <em>prob</em> is between one and one hundred. Similarly, :post asserts that the function returns a list (although I haven&#8217;t mentioned it, the :post tag operates much like :pre, using a function&#8217;s return value within its assertion). So in spite of my trivial examples, perhaps you can begin to appreciate how these tags can be used to create safer and more predictable code.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ethanjfast.com/2009/12/clojure-pre-and-post/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Slowly Programming in R</title>
		<link>http://blog.ethanjfast.com/2009/12/slowly-programming-in-r/</link>
		<comments>http://blog.ethanjfast.com/2009/12/slowly-programming-in-r/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 13:43:23 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[R Programming Language]]></category>

		<guid isPermaLink="false">http://blog.ethanjfast.com/?p=231</guid>
		<description><![CDATA[Recently, I coded up a cross validation function in R, and things were moving rather less quickly than I would have liked. (The purpose of c.v. is to assess how well one&#8217;s statistical analysis will generalize to an independent data set.)  Anyhow, I was implementing 10-fold cross validation, and with a dataset containing around 100,000 observations, my [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I coded up a <a href="http://en.wikipedia.org/wiki/Cross-validation_(statistics)">cross validation</a> function in R, and things were moving rather less quickly than I would have liked. (The purpose of c.v. is to assess how well one&#8217;s statistical analysis will generalize to an independent data set.)  Anyhow, I was implementing 10-fold cross validation, and with a dataset containing around 100,000 observations, my code was taking hours to run. This was, of course, ridiculous.</p>
<p>Now, I doubt that it will come as a surprise, but I am rather a newbie at this whole R thing, and as I later found out, loops in R should be avoided at all costs. After hacking around with my code, I found that its critical path looked something like this:<br />
<code><br />
total &lt;- 0<br />
for(i in 1:nrow(dataset)){<br />
total &lt;- total + sum( dataset[i,1:25]*coef )<br />
}<br />
</code><br />
Now this is very simple loop, and it seemed to me somewhat less than obvious that it would beget a significant performance bottleneck. Ever so naturally, then, it did.</p>
<p>Ironically, the solution here is to use code more along the lines of the map-reduce paradigm, something I would have loved to do in the first place, were not I overcome by the cryptic nature of R&#8217;s documentation. After all, my favorite languages are all variants of lisp, and I am no stranger to functional programming. After some digging, I stumbled across <em>apply</em>, which more-or-less functions along the lines of <em>map</em> in scheme or clojure. So I tried:<br />
<code><br />
my_sum &lt;- function(x){ sum( x[1:25]*coef ) }<br />
sum( apply( dataset, my_sum ) )<br />
</code><br />
In addition to being more elegant, this is much, much faster. What was taking hours, now takes tens of seconds. Apparently, R has a fast backend implementation for this sort of thing.  So, this post is dedicated to as a warning to my fellow inexperienced users: avoid iterative loops in R!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ethanjfast.com/2009/12/slowly-programming-in-r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>National Novel Writing Month</title>
		<link>http://blog.ethanjfast.com/2009/12/national-novel-writing-month/</link>
		<comments>http://blog.ethanjfast.com/2009/12/national-novel-writing-month/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 20:20:37 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://blog.ethanjfast.com/?p=224</guid>
		<description><![CDATA[In circumstances rather less than coincidental, a conspicuous absence of November posts coincided with my participation in NaNoWriMo (national novel writing month). Thus, throughout last month, I had a great &#8212; if difficult &#8212; time writing what might be described as a shallow antithesis to the next Great American Novel. Ever so sadly, fifty thousand words was not enough to contain the [...]]]></description>
			<content:encoded><![CDATA[<p>In circumstances rather less than coincidental, a conspicuous absence of November posts coincided with my participation in <a href="http://www.nanowrimo.org/">NaNoWriMo</a> (national novel writing month). Thus, throughout last month, I had a great &#8212; if difficult &#8212; time writing what might be described as a shallow antithesis to the next Great American Novel. Ever so sadly, fifty thousand words was not enough to contain the <a href="http://en.wikipedia.org/wiki/Psychobabble">deep complexities</a> of my story, but as such trivialities have no bearing on whether one actually <em>wins </em>the challenge, all ended reasonably well.</p>
<p>As this blog serves a largely technical purpose, I ought to mention my use of latex (specifically, <a href="http://pierre.chachatelier.fr/programmation/latexit_en.php">LaTeXIT</a>) for all of November&#8217;s writings. This decision was mostly to my benefit &#8212; the pdf files produced look wonderful, and the memoir package made chapter organization easy &#8212; but it also beget a few annoyances. For instance, getting decent word count updates was rather non-trivial, and the NaNoWriMo site does not accept pdf or tex files for verification. Ultimately, however, my experience was a positive one, and I would recommend latex to future participants.</p>
<p>In any case, I can assure the nonexistent reader that this blog should become more active in future days and weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ethanjfast.com/2009/12/national-novel-writing-month/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
