<?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"
	>

<channel>
	<title>leftwise</title>
	<atom:link href="http://blog.leftwise.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.leftwise.com</link>
	<description>I'm Derek. This is my blog.</description>
	<pubDate>Fri, 04 Jun 2010 19:08:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Guaranteed code</title>
		<link>http://blog.leftwise.com/2010/06/03/guaranteed-code/</link>
		<comments>http://blog.leftwise.com/2010/06/03/guaranteed-code/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 04:43:17 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[clojure]]></category>

		<category><![CDATA[fp]]></category>

		<category><![CDATA[haskell]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.leftwise.com/?p=33</guid>
		<description><![CDATA[I was thinking lately about the different philosophies programming languages expose when it comes to guaranteeing code semantics. It&#8217;s interesting to compare two of my favorite languages - Ruby and Clojure - and a third I like, but don&#8217;t know well enough to love: Haskell, since each lies at a different point along the imperative [...]]]></description>
			<content:encoded><![CDATA[<p>I was thinking lately about the different philosophies programming languages expose when it comes to guaranteeing code semantics. It&#8217;s interesting to compare two of my favorite languages - Ruby and Clojure - and a third I like, but don&#8217;t know well enough to love: Haskell, since each lies at a different point along the imperative to purely functional spectrum, and each can give you a different level of confidence in your code&#8217;s execution.</p>
<p>In particular, I&#8217;m referring to the level of confidence a language can impart that when you call some method (or evaluate some function) in a particular language, your code will work the same afterward. This is directly related to side effects, and how much you have to &#8220;know&#8221; about the function&#8217;s implementation in order to use it. I&#8217;ll colloquially refer to this as &#8220;trustworthiness&#8221;.</p>
<p><span id="more-33"></span></p>
<p>At one extreme, a language might not especially concern itself with ensuring trustworthiness. If whoever wrote the method you&#8217;re calling Did The Right Thing, the method is trustworthy. Ruby is an example of a language like this: fully dynamic (&#8221;duck typing&#8221;) and extensible at runtime (&#8221;monkey patching&#8221;). I can do normal mutable stuff and touch storage locations that other code might care about in Ruby, but I can also write a method which affects the semantics of other methods; for example, when you&#8217;re inside Rails, the String class is enhanced with a bunch of utility functions. Here is an extremely contrived example:</p>
<pre class="brush: ruby">
def foo(a)
  a.respond_to?(:bar) ? a.bar : nil
end

def baz(a)
  a.class.instance_eval do
    define_method(:bar) { "barbarbar" }
  end
  nil
end
</pre>
<p><tt>foo</tt> calls its argument&#8217;s <tt>bar</tt> method, if such a method exists; <tt>baz</tt> takes an object and extends its class with a <tt>bar</tt> method. Then, this series of calls evaluates like:</p>
<pre class="brush: ruby">
foo("abc") # => nil
baz("abc") # => nil
foo("abc") # => "barbarbar"
</pre>
<p>As you can see, the method <tt>foo</tt> isn&#8217;t <a href="http://en.wikipedia.org/wiki/Idempotent">idempotent</a>. It&#8217;s not possible to write a Ruby method that you can guarantee to be idempotent unless it evaluates to a literal, because everything else is a method call on an object, and the behavior of existing classes and object instances can be modified at runtime. So, for example, even:</p>
<pre class="brush: ruby">
1 + 2
</pre>
<p>Isn&#8217;t guaranteed to be 3, because <tt>+</tt> is a method call, equivalent to <tt>1.+(2)</tt>. Of course, no one ever worries about this in real life, because you would be evil if your Ruby library changed the definition of the <tt>+</tt> method on Fixnum. But there is nothing to prevent it. So, Ruby is very versatile in its flexibility; as a trade-off, it is difficult or impossible to <b>guarantee</b> that your code will exhibit some set of particular semantics at runtime.</p>
<p>At the other extreme is something like Haskell, which is purely functional and strongly typed. I&#8217;m new at Haskell (though have some experience with other pure FP, typed languages like standard ML), so this next section might have some syntax errors. Anyway. Values are immutable, so you cannot change state, only write code that produces new values. Every expression has a type. Side effects are hidden in monads, which can be made one-way by the type system. In Haskell, producing a side effect like writing output goes to the IO monad, which &#8220;sucks&#8221; code into a world where the possibility of side effects happening is made clear by the type system. For example, <tt>putStrLn</tt> looks like this:</p>
<pre class="brush: hs">
putStrLn :: String -> IO ()
</pre>
<p>It takes a String and returns an <tt>IO ()</tt>, which you can think of like a queued IO action. When the action is eventually performed, it prints the given string out followed by a newline.<br />
 You don&#8217;t get information about types inside the <tt>IO ()</tt>, so you can&#8217;t pull information out of it. The only way to &#8220;evaluate&#8221; the effect and have something actually print is to use the <a href="http://en.wikipedia.org/wiki/Monad_%28functional_programming%29#Definition">monadic binding function</a>, whose type looks like this for the <tt>IO ()</tt> values <tt>putStrLn</tt> produces:</p>
<pre class="brush: hs">
String -> (() -> IO b) -> IO b
</pre>
<p>So you provide the string to write, but then you <b>must</b> provide a function whose type is <tt>() -> IO b</tt>. In other words, to perform the side effect, you have to produce code that returns a value wrapped &#8220;inside&#8221; the IO monad type. For example, check out this function, <tt>times2</tt>, which takes one argument (an Integer for this example, although without the type signature Haskell will derive this to a typeclass function on anything under <tt>Num a</tt>), and produces a new integer, the argument times 2.</p>
<pre class="brush: hs">
times2 :: Integer -> Integer
times2 i = let x = (putStrLn "a line")
               y = (putStrLn "another line")
               z = 2 in
           i * z
</pre>
<p>Does calling this function cause those strings to be printed? Nope. Haskell&#8217;s evaluation is lazy, and the things we are binding <tt>x</tt> and <tt>y</tt> to in the let block are expressions. That means they will only be evaluated if they are actually needed. We return <tt>i * z</tt>, and so <tt>x</tt> and <tt>y</tt> don&#8217;t make it out of the function. Nothing can ever get to them, so they can never be evaluated and no side effects will happen. In fact, because Haskell is strongly typed,  any values that <b>could</b> get out would have to be a part of the function&#8217;s type signature, so without even looking at the implementation, you could guarantee that no side effect would happen:</p>
<pre class="brush: hs">
times2 :: Integer -> Integer
</pre>
<p>See? There are no <tt>IO</tt>&#8217;s in there. So no values that could possibly produce IO side effects can come out of this function. Additionally, there is no function in the type system that lets you &#8220;get out&#8221; of the IO monad; in other words, any function that takes a value of type <tt>IO</tt> must ultimately produce another value of type <tt>IO</tt>. It&#8217;s like a roach motel for side effecting execution: code goes in, but it doesn&#8217;t get out. So, if there were any deep, hidden code in our <tt>times2</tt> function that made the IO happen, <tt>IO</tt> would have to percolate out into the type signature of <tt>times2</tt>.</p>
<p>That means that I can use any arbitrary Haskell function, and if <tt>IO</tt> isn&#8217;t somewhere in the type signature, I am <b>guaranteed</b> no IO effect can happen. There is no well-typed statement that would allow it. Code that doesn&#8217;t involve the IO type must willingly pass a &#8220;side effects ahoy&#8221; line to a domain that allows side effects, by &#8220;getting into&#8221; the IO monad and picking up the type. So code that doesn&#8217;t involve it can have guaranteed semantics, no side effects allowed, no changing of state. The tradeoff is that you have to adhere to strict rules.</p>
<p>Clojure is somewhere closer to the middle, at least in spirit, if not in strictness. The core Clojure data structures are immutable (as in their values are in Java <tt>final</tt> variables), so if you stick within the domain of those data structures and the functions that operate on them, you can have code that&#8217;s idempotent. Evaluation is eager, but much of the standard library supports lazy evaluation by producing sequences, which are like cons cells whose <tt>car</tt>s are thunked. There is no strict type system to force you to be visible about side effects or warn callers about things you might do. So most Clojure code is written in such a way that the side effecting parts are hidden in private namespace functions, and the public interface is functional. There are well-defined ways to have statefulness in Clojure, so you can write code that must be explicit about its side effect-ness:</p>
<pre class="brush: clj">
(let [a (atom 0)]
  (defn post-inc! [n]
    (let [curr @a]
      (do
         (swap! a #(+ % n))
         curr))))

(post-inc! 1) ;; => 0
(post-inc! 1) ;; => 1
(post-inc! 1) ;; => 2
</pre>
<p>Here, <tt>post-inc!</tt> is obviously not idempotent, but we had to explicitly create a reference type and use a subset of functions in our code restricted to that type. So, if we stick within Clojure&#8217;s core types and semantics, we can have areas of guarantee. For Clojure code operating with other classes on the JVM, say a Java API, though, all bets are off, since we can&#8217;t guarantee anything about the side-effecting nature of external JVM code.</p>
<p>As far as laziness, you can opt-in to it, and code generally shouldn&#8217;t have to care if it operates at the sequence level of abstraction.</p>
<pre class="brush: clj">
(defn int-range [a b]
   (when (< a b) (cons a (int-range (inc a) b))))

(defn lazy-int-range [a b]
   (when (< a b) (lazy-seq (cons a (lazy-int-range (inc a) b)))))

(int-range 0 5) ;; => (0 1 2 3 4), realized in memory
(lazy-int-range 0 5) ;; => a lazy sequence of  (0 1 2 3 4), realized when consumed
</pre>
<p>Which allows you to write expressions like <tt>(lazy-int-range 0 100000)</tt> with causing a stack overflow, but doesn&#8217;t require sequence consuming code to know whether the sequence is lazy or not to do what it needs to logically. So you are able to opt-in to many interesting language features like laziness when solving a problem; the tradeoffs are that there are more rules than Ruby in the optional parts, and that because the strict parts are optional, you don&#8217;t get the semantic guarantees of Haskell.</p>
<p>In a future post, I hope to get into the &#8220;related behavior&#8221; bit, discussing the ways that the 3 languages approach it: Ruby with its object-orientation, where data and behavior are packed up in classes and instances; Haskell&#8217;s typeclasses and instance derivation, where behavior is specified in a named unit, a typeclass, and concrete implementations give types membership in that typeclass), and Clojure&#8217;s new protocols/deftype feature (behavior is specified in a named unit, the protocol, and concrete &#8220;types&#8221; that implement it are made through <tt>deftype</tt>&#8216;d factories), which seems spiritually very similar to Haskell&#8217;s typeclasses. As always, thanks for reading!</p>
<p><script type="text/javascript">
SyntaxHighlighter.all();
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leftwise.com/2010/06/03/guaranteed-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Books: Moab is my Washpot</title>
		<link>http://blog.leftwise.com/2010/05/28/books-moab-is-my-washpot/</link>
		<comments>http://blog.leftwise.com/2010/05/28/books-moab-is-my-washpot/#comments</comments>
		<pubDate>Sat, 29 May 2010 00:04:30 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
		
		<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://blog.leftwise.com/?p=32</guid>
		<description><![CDATA[B-A and I just returned from vacation in the lovely beachside town of Cambria, CA. We first went there for a friend&#8217;s wedding and fell in love with the town; it&#8217;s small, not too far from an airport, not too crowded, and right on the beach, which means the weather is usually fantastic.
I was also [...]]]></description>
			<content:encoded><![CDATA[<p>B-A and I just returned from vacation in the lovely beachside town of <a href="http://www.cambriachamber.org/">Cambria, CA</a>. We first went there for a friend&#8217;s wedding and fell in love with the town; it&#8217;s small, not too far from an airport, not too crowded, and right on the beach, which means the weather is usually fantastic.</p>
<p>I was also very glad to avail myself of the opportunity to dive into some books. I used to read voraciously. To my chagrin, these days I spend a lot of time skimming or reading articles instead of reading books. But, I read a few on the trip, and the one that&#8217;s fresh in my mind is Stephen Fry&#8217;s <a href="http://www.amazon.com/Moab-My-Washpot-Stephen-Fry/dp/1569472025">Moab is my Washpot</a>, an autobiographical account of his years as a child in the British preparatory and public school system, up to his acceptance at Cambridge.</p>
<p><span id="more-32"></span></p>
<p><center><img src="/images/moab.jpg" /></center></p>
<p>&nbsp;</p>
<p>If you don&#8217;t know <a href="http://en.wikipedia.org/wiki/Stephen_Fry">Stephen Fry</a>, well, I probably can&#8217;t do better justice for a biographical sketch than the wikipedia page. Primarily an actor and writer, I&#8217;ve long been a fan of his work, first becoming hooked by his performance of Jeeves alongside Hugh Laurie&#8217;s Bertie Wooster in the 1990 BBC run of <i>Jeeves and Wooster</i>, itself adapted from the brilliant <i>Jeeves</i> stories by P.G. Wodehouse.</p>
<p><i>Moab</i> is a wonderfully witty piece of work, describing his early years and self-discovery as a writer, life in a British preparatory school, love - and complete lack of ability in - music, coming to terms with his sexuality, falling in love for the first time, and embarking on an early life of crime ending with a felony conviction for theft at the tender age of eighteen. The best autobiographies are both poignant in their description of formative experiences and piercing, connecting you to the author in shared experience. Each human life is a perfectly unique, ramshackle collection of experiences resulting in <i>you</i>, but we are all transformed in the same ways throughout life, emerging from the crucible of adolescence as proto-adults, with most of our basic foundations intact. Successful autobiographers reveal things in their books that people otherwise vigorously hide away; deep corners of their psyche, hopes and fears that they share with no-one else. The same hopes, fears and secrets that we all have. The trick of the gifted autobiographer is to share these things and connect them to the same hidden pockets inside you; to make you - a nameless, faceless reader Out There in the world - a close friend and confidante. If they&#8217;re <i>really</i> good, they&#8217;ll do so with an envious ease that all great writers seem to summon without a thought.</p>
<p>I quite recommend this book if you like autobiographies, Stephen Fry, clever writing, the nostalgia of British country life in the 1950&#8217;s and 60&#8217;s, or any combination thereof.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leftwise.com/2010/05/28/books-moab-is-my-washpot/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Clojure, with a Project Euler example</title>
		<link>http://blog.leftwise.com/2010/05/12/clojure-with-a-project-euler-example/</link>
		<comments>http://blog.leftwise.com/2010/05/12/clojure-with-a-project-euler-example/#comments</comments>
		<pubDate>Wed, 12 May 2010 19:18:55 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[clojure]]></category>

		<guid isPermaLink="false">http://blog.leftwise.com/?p=31</guid>
		<description><![CDATA[Most of this post will be about Clojure, a LISP dialect that is implemented on top of the JVM. The Clojure community is quickly growing; every day you&#8217;ll find new blog posts describing people&#8217;s experiences with it. The Clojure mailing list is filled with helpful posters and great advice; the Clojure IRC channel is, similarly, [...]]]></description>
			<content:encoded><![CDATA[<p>Most of this post will be about <a href="http://clojure.org/">Clojure</a>, a LISP dialect that is implemented on top of the JVM. The Clojure community is quickly growing; every day you&#8217;ll find new blog posts describing people&#8217;s experiences with it. The <a href="http://groups.google.com/group/clojure">Clojure mailing list</a> is filled with helpful posters and great advice; the Clojure IRC channel is, similarly, a great resource. It&#8217;s no surprise that this is the case, since Clojure as a language comes with some very compelling features. In no particular order, I&#8217;ll enumerate some of the things I&#8217;m really enjoying about Clojure. Then, I&#8217;ll discuss a solution to <a href="http://projecteuler.net">Euler problem #24</a> in Clojure, since examples are always fun.</p>
<p><span id="more-31"></span></p>
<p>Java is not my favorite language to write. I find it to be verbose to the point of lowering productivity; I feel as if I write more metainformation to the compiler about what I am doing (specific types, access and visibility modifiers everywhere, checked exception declarations) than actually implementing the logic to solve a problem. I understand the point of view that Java&#8217;s explicitness and compile-time type checking produce better code, I just think it is wrong. There are many legitimate reasons to dislike the Java language&#8217;s design choices. I won&#8217;t detail them here; you&#8217;ve either heard them all before, or you can find many examples with a simple Google search.</p>
<p>I am, however, very impressed with the JVM as a platform. It&#8217;s stable, well supported, and well understood; whoever is in charge of deploying your software is probably comfortable with deploying and administering a JVM instance. Optimization techniques in the JVM continue to get better and better, particularly with some vendor implementations (such as HotSpot with Sun). You can get heavily optimized code that is very fast without a large amount of effort. As a digression, watching recent developments in optimizing bytecode is very cool (see clang/llvm, the jvm/hotspot, the .net clr, etc) and I&#8217;m excited to see how things progress in the future with those projects.</p>
<p>The takeaway here is that the JVM is a great platform. And now that there are several languages written to run on the JVM that are not Java, you have some great choices as a developer who maybe doesn&#8217;t so much enjoy writing Java. You can choose a JVM bytecode-compiled language that best fits your problem space (Groovy, Scala, Clojure, etc.), and immediately be able to leverage the huge number of libraries out there written for the JVM, including the Java standard library. And get nice, fast code while you&#8217;re at it. Great! All we need now is a specific bytecode instruction for dynamic method dispatch on the JVM, and life is sweet - so it&#8217;s a good thing that such an instruction is <a href="http://www.jcp.org/en/jsr/detail?id=292">planned for the Java 7 specification</a>.</p>
<ol>
<li><b>Clojure is a LISP&#8230;</b><br/>It displays <a href="http://en.wikipedia.org/wiki/Homoiconic">homoiconicity</a>, which means (roughly) that code and data are represented in the same way in Clojure (as s-expressions). This has deeper implications that I can cover in a blog post, but, for example, if you have written code to do a particular kind of list manipulation, it can act equally on actual lists of data, or a list that represents an s-expr to be evaluated. Clojure fully supports macros, which allow you to modify the s-expr tree as it passes through the reader. It has a minimal syntax that elegantly models computation, especially if you view computation through the lens of the <a href="http://en.wikipedia.org/wiki/Lambda_calculus">lambda calculus</a>. In other words, it&#8217;s a LISP!</li>
<li><b>&#8230;minus some historical baggage</b><br/><br />
Clojure sports a selection of <a href="http://clojure.org/data_structures">core data structures</a> that offer particular semantics and performance guarantees; the core structures are implemented efficiently and their design is well-considered. When applicable, functions exist to act on various abstractions as a structure (for example, there are functions that operate on anything that looks &#8220;sequential&#8221;, and most of the core data structures provide a way they can be viewed sequentially). From my perspective, Clojure very much wants you to &#8220;use the right tool for the job&#8221;, and provides several high quality tools in its toolbox to enable you to do so.
</li>
<li>It&#8217;s <b>functional</b>, with <b>immutable data types</b>.<br/><br />
What a pleasure it is to be able to view problems through a few different lenses, and how tiring it is to always view a problem through the OO lens. There are many arguments for (and against) functional programming; if, like me, you are a fan, you will be happy to learn that Clojure data structures are immutable (let&#8217;s omit discussion of the new &#8220;transients&#8221; feature for now). You do not (and in fact, if you are using one of the built-in Clojure datatypes, <b>cannot</b>) modify an existing value. &#8220;Changing a value&#8221; means &#8220;creating a new value with my changes&#8221;, implemented efficiently through structural sharing. This means a lot of good things, one of which is that&#8230;</li>
<li><b>Clojure does concurrency the right way</b>.<br/><br />
Writing concurrent software is hard, especially if you model your concurrency around controlling access to a central mutable storage location. Unfortunately a lot of concurrent software is modelled this way. Most of the difficulty in this method comes in controlling access to the central mutable storage. Code written in this style is usually about acquiring locks, doing stuff, and releasing locks, and constantly balancing lock acquisition with its tradeoffs (acquiring a lock is usually an expensive operation, so you can&#8217;t spray lock acquisition everywhere; if you hold a lock, you are solely responsible for preventing deadlocks and making sure you release it at the proper time, etc). By contrast, having immutable data types remove a lot of this complexity: threads can&#8217;t modify the same value, because modifying values is verboten.  I&#8217;ll just give you a value I want you to do some work with, and I never have to worry about you modifying some state that might affect my execution, because you can&#8217;t modify any values in my thread: <b>they are immutable</b>! See Erlang&#8217;s message-passing concurrency model for an example of this type of approach. Like datatypes, concurrency in Clojure is exposed by a handful of discrete concurrency operators offering particular semantics and performance, each is well-supported, and each is well thought out. Check out the <a href="http://clojure.org/refs">ref</a> documentation on the Clojure page for one example.</li>
<li><b>It does many other things right.</b><br/><br />
Lazy evaluation, robust interaction with the host platform, and a comprehensive core library are just some examples of this point. You may not like some of Clojure&#8217;s design choices, but if you watch some of <a href="http://clojure.blip.tv/">Rich Hickey&#8217;s screencasts</a>, you can&#8217;t argue that the design isn&#8217;t a carefully considered one.</li>
</ol>
<p>Enough talking; let&#8217;s write some code. Euler problem #24&#8217;s problem statement basically says:</p>
<blockquote><p>Given the digits 0 through <i>N</i>, and all permutations of those digits, arrange the permutations lexicographically, and return the <i>n</i>th permutation, for <i>N</i>=9 and <i>n</i>=1000000.</p></blockquote>
<p>Like many Euler problems, there are many ways to solve this one, but I&#8217;m feeling lazy - literally. My solution will be to construct a <b>lazy</b> data structure that enumerates all the permutations lexicographically, and then write code that <b>realizes</b> the <i>n</i>th permutation. Easy, right?</p>
<p>So let&#8217;s write a method that produces this lazy data structure. Let&#8217;s suppose we&#8217;re given a set of numbers that are ordered lexicographically (0, 1, 2&#8230; N). Here&#8217;s an inductive method we could use to enumerate every permutation of those elements in lexicographic order:</p>
<ol>
<li>Take the first element of the set; call it H. The remaining elements of the set (still in order) are T.</li>
<li>Recursively generate all permutations (in lexicographic order) of T.</li>
<li>Take each permutation of T and prepend H to it: the resultant list is the ordered permutations of the input set that begin with H.</li>
<li>Repeat with the second element of the set as the next H and T to be the set with the second element removed, then with H as the third element, and so on until the set is exhausted.</li>
<li>The sequence of lists produced in this way represent every permutation of the original set in lexicographic order.</li>
<li>As a base case, the empty list has only one permutation: itself (the identity permutation).</li>
</ol>
<p>That&#8217;s a lot of pseudocode, but easy to express in a couple lines of Clojure:</p>
<pre class="brush: clj">
(defn permute [coll]
   (when-let [s (seq coll)]
         (map (fn [x] (cons x (permute (remove #(= x %) s)))) s)))
</pre>
<p>This works for my solution because <tt>map</tt> and <tt>remove</tt> produce lazy sequences in Clojure. Laziness is pervasive in most Clojure sequence operators; operators that realize sequences   generally tell you explicitly that they will do so. In other words, the result of applying permute to a collection will be a bunch of queued function application, and the evaluation will only happen when you actually reference a particular item (and then only as much as needed to realize that item).</p>
<p>The method above will return a sequence of two-element (cons) cells; the head (car) of each cell is an item in the permutation, and the tail (cdr) of each cell is another (ordered) sequence of all the permutations that start with the head element. It&#8217;s essentially a tree modeled as cons cells. Finally, the <tt>when-let</tt> handles our base case: when the sequence is empty, when-let will evaluate to <tt>nil</tt>.</p>
<p>Let&#8217;s assume there&#8217;s a <tt>factorial</tt> method in clojure. It&#8217;s trivial to write one of your own. We&#8217;ll use this to count how many permutations are in a particular subsequence, since the number of permutations of N elements is N!. Since each cell in the sequence that <tt>permute</tt> returns is the head of all subsequences that start with that element, as we move through the sequence and skip over a cell, we&#8217;ll want to know how many permutations we passed over. This will let us navigate to a particular permutation, like permutation number 1000000.</p>
<p>Next we&#8217;ll write the method to seek to the particular permutation we want in this data structure; let&#8217;s call it <tt>seek</tt>. This is a helper function, so we&#8217;ll declare it with <tt>defn-</tt>, so it doesn&#8217;t pollute our namespace (if we compiled this code to a class, it would become a private method). Here it is:</p>
<pre class="brush: clj">
(defn- seek
  ([s parts i acc]
   (if (empty? s) acc
     (let [partsize (factorial (dec parts))
           permutation (nth s (quot i partsize))
           data (first permutation)
           remainder (rest permutation)]
       (recur remainder (dec parts) (mod i partsize) (conj acc data)))))
  ([s parts i] (seek s parts i [])))
</pre>
<p>Most of the logic of the problem is here. There are a few things to note. One is using arity overloading to make the default for <tt>acc</tt> the empty vector (<tt>[]</tt>), if one isn&#8217;t passed in; this seems to be idiomatic Clojure, as far as I can tell. You may also notice that the seek function is written in fake tail-recursive style (passing an accumulator and using <tt>recur</tt>), since the JVM doesn&#8217;t natively support tail-call optimization, this is syntactic sugar Clojure gives you to simulate it, by making iteration look less iterate-y.</p>
<p>So, this function takes a sequence of permutations in the format returned by <tt>permute</tt>, the number of elements the permutations represent (called <tt>parts</tt>), the element you want to seek to (<tt>i</tt>), and an accumulator; the permutation found at position <tt>i</tt> will be appended to the accumulator.</p>
<p>If the sequence is exhausted, we can&#8217;t iterate any further, so we return the accumulator. If not, the method finds which element of the top-level sequence the <tt>i</tt>th permutation lives under, remembering that every element we skip over really skips over <tt>parts!</tt> permutations that lie underneath it. So, we identify how many top-level elements of the sequence we want to skip over and do so: <tt>(nth s (quot i partsize))</tt>. We identify, within this subsequence, the index of the permutation we want to find, which is <tt>(mod i partsize)</tt>, in other words, if you have 100 elements divided into 5 buckets of 20 items each, and you want element 43, you want element 3 (43 mod 20) of bucket 2 (43 quot 20). Then we recur with the subsequence to find that element.</p>
<p>Finally, we tie it all together to answer the problem:</p>
<pre class="brush: clj">
(defn ith-permutation [n i]
  (let [coll (range (inc n))]
    (seek (permute coll) (count coll) (dec i))))
</pre>
<p>We generate the numbers from 0 to 9, inclusive, create all of the permutations of those numbers with <tt>permute</tt>, then seek to the <tt>i</tt>th element with <tt>seek</tt>. It&#8217;s not even that slow for the parameters of the euler problem (microbenchmarking caveats ahoy).</p>
<pre class="brush: clj">
user=> (time (ith-permutation 9 1000000))
"Elapsed time: 4.103 msecs"
-answer omitted-
</pre>
<p>Not bad, especially since this method was our first pass and we haven&#8217;t done anything to make it more optimal. This blog post became a lot of text, but think about what we did once we started coding:</p>
<ul>
<li>We expressed the problem in a simple way: finding the right element in a structure of all possible elements.
<li>We then naively generated that data structure in code. We didn&#8217;t eat a bunch of CPU and memory because the data structure was generated lazily.</li>
<li>We expressed searching through this data structure inductively, in terms of finding the right sub-structure to look in, then recursively looking in it.</li>
<li>Our code solves the problem and is reasonably fast.</li>
</ul>
<p>There are certainly more succinct ways to solve this problem, and like many Euler problems, doing a little math on paper can help you discover methods that are faster; we essentially brute-forced it, but we didn&#8217;t have to incur too much pain to do the brute-forcing, thanks to Clojure&#8217;s lazy sequences.</p>
<p>Whew! That was a long blog post! If you&#8217;re still here, thanks for reading! You can find the code for this post at a gist <a href="http://gist.github.com/399010">here</a>. In addition, if you were intrigued by Clojure, you&#8217;ll find good links and excellent documentation at <a href="http://clojure.org">the home page</a>. I also really enjoyed watching some of the slide presentations at <a href="http://clojure.blip.tv">the blip.tv clojure site</a>; in particular I recommend &#8220;Clojure for LISP programmers&#8221; (or &#8220;Clojure for Java Programmers&#8221; if that&#8217;s your thing).</p>
<p>I hope to blog more about Clojure soon.</p>
<p><script type="text/javascript">
SyntaxHighlighter.all();
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leftwise.com/2010/05/12/clojure-with-a-project-euler-example/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bread.</title>
		<link>http://blog.leftwise.com/2010/03/01/bread-2/</link>
		<comments>http://blog.leftwise.com/2010/03/01/bread-2/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 05:03:49 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
		
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.leftwise.com/?p=30</guid>
		<description><![CDATA[I continue to work on bread. It&#8217;s a tricky one, but I think I am slowly absorbing the Zenlike secret of good baking, which is to say it usually turns out great when I don&#8217;t care, and terrible when I&#8217;m really trying hard to make good bread.
Here&#8217;s my latest:



How&#8217;s the crumb, you ask? Behold my [...]]]></description>
			<content:encoded><![CDATA[<p>I continue to work on bread. It&#8217;s a tricky one, but I think I am slowly absorbing the Zenlike secret of good baking, which is to say it usually turns out great when I don&#8217;t care, and terrible when I&#8217;m really trying hard to make good bread.</p>
<p>Here&#8217;s my latest:<br />
<center><br />
<a href="http://www.flickr.com/photos/derekgr/4399829367/" title="bread by DerekGr, on Flickr"><img src="http://farm3.static.flickr.com/2735/4399829367_4dfff9f36e.jpg" width="500" height="287" alt="bread" /></a><br />
</center></p>
<p>How&#8217;s the crumb, you ask? Behold my works, ye mighty, and despair:<br />
<center><br />
<a href="http://www.flickr.com/photos/derekgr/4399849725/" title="bread-2 by DerekGr, on Flickr"><img src="http://farm5.static.flickr.com/4039/4399849725_263b6f6eb0.jpg" width="500" height="291" alt="bread-2" /></a><br />
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leftwise.com/2010/03/01/bread-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bread!</title>
		<link>http://blog.leftwise.com/2010/01/20/bread/</link>
		<comments>http://blog.leftwise.com/2010/01/20/bread/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 05:17:25 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
		
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.leftwise.com/?p=28</guid>
		<description><![CDATA[I&#8217;ve been working on bread lately. Here&#8217;s a good one!

&#160;
I bought a peel on Amazon, and decided to try it out by making some pizza. I hoped the peel would help dough to stick less, but it was still thoroughly sticky. Either I&#8217;m not using enough cornmeal or I have to grease it or something, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on bread lately. Here&#8217;s a good one!<br />
<center><a href="http://www.flickr.com/photos/derekgr/4291717981/" title="bread! by DerekGr, on Flickr"><img src="http://farm5.static.flickr.com/4029/4291717981_50067d8f92.jpg" width="500" height="288" alt="bread!" /></a></center></p>
<p>&nbsp;</p>
<p>I bought a <a href="http://www.armchair.com/store/gourmet/baking/peel1.jpg">peel</a> on Amazon, and decided to try it out by making some pizza. I hoped the peel would help dough to stick less, but it was still thoroughly sticky. Either I&#8217;m not using enough cornmeal or I have to grease it or something, or it sticks, and that sucks, especially when you go to slide a pizza into a hot oven and the toppings slide off instead. So I read <a href="http://whatscookingamerica.net/History/Pizza/PizzaRecipes.htm">about a trick</a> with parchment paper that should hopefully work for all sorts of stone-cooked things. You place the dough on a piece of parchment paper on top of the peel, and it slides straight off onto the stone. The stone&#8217;s hot enough to bake the bottom of the crust through the paper; parchment paper can withstand the high heat for a few minutes. After waiting a couple minutes for a crust to form, pick up the pizza a bit with the peel and slide the paper out, so the crust is right against the stone, and then just finish as usual. Very handy!</p>
<p>After making some dough and letting it rise, this ball (B-A said it was &#8220;adoughable&#8221;): </p>
<p><center><a href="http://www.flickr.com/photos/derekgr/4291718007/" title="20100120-IMG_1647 by DerekGr, on Flickr"><img src="http://farm3.static.flickr.com/2674/4291718007_fa5944022a_m.jpg" width="195" height="240" alt="20100120-IMG_1647" /></a></center></p>
<p>&nbsp;</p>
<p>Plus basil, chopped garlic, olive oil, and shredded mozzarella, became this:</p>
<p><center><a href="http://www.flickr.com/photos/derekgr/4291718539/" title="pizza. by DerekGr, on Flickr"><img src="http://farm5.static.flickr.com/4026/4291718539_300e852b74.jpg" width="500" height="403" alt="pizza." /></a></center></p>
<p>&nbsp;</p>
<p>And after a short failed peel experiment, came out like this:</p>
<p><center><a href="http://www.flickr.com/photos/derekgr/4292459146/" title="pizza! by DerekGr, on Flickr"><img src="http://farm5.static.flickr.com/4061/4292459146_72f9953d31.jpg" width="491" height="500" alt="pizza!" /></a></center></p>
<p>&nbsp;</p>
<p>You can see the streaks on the crust where some of the cheese slid off due to the sticky peel. It tasted really good, although it was a little high of an edge-to-topping ratio. It&#8217;s a nice meal and a good way to use up those mushrooms or peppers that are about to go bad in the fridge.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leftwise.com/2010/01/20/bread/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Post-mortem</title>
		<link>http://blog.leftwise.com/2009/12/21/post-mortem/</link>
		<comments>http://blog.leftwise.com/2009/12/21/post-mortem/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 18:25:51 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
		
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.leftwise.com/?p=27</guid>
		<description><![CDATA[It went pretty well. Going to the Pearl St. Whole Foods the weekend before the Christmas holiday, was, in retrospect, bad news. The store was a total madhouse. Not to mention their terrible parking lot. But, the meal went off pretty well. I made it essentially as described in my previous post. I didn&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>It went pretty well. Going to the Pearl St. Whole Foods the weekend before the Christmas holiday, was, in retrospect, bad news. The store was a total madhouse. Not to mention their terrible parking lot. But, the meal went off pretty well. I made it essentially as described in my previous post. I didn&#8217;t have much time to prep the fish, so there were a few bones. In the future, the whole process would be much faster if I just ordered bones for the stock from the fish supplier, then took pre-cut fillets for the actual poaching.</p>
<p>I also went to the Savory Spice shop, which was pretty incredible. Nice smells and a huge selection.</p>
<p>For dessert, I made an apple-pear tart. There were some really nice apples at Whole Foods, so I just went for it. Everyone really enjoyed the meal. I got a request for beef or poultry next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leftwise.com/2009/12/21/post-mortem/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I like to cook</title>
		<link>http://blog.leftwise.com/2009/12/17/i-like-to-cook/</link>
		<comments>http://blog.leftwise.com/2009/12/17/i-like-to-cook/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 22:18:20 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
		
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.leftwise.com/?p=26</guid>
		<description><![CDATA[Really, I like to cook anything, but specifically, I enjoy cooking French food. It doesn&#8217;t hurt that I love to eat and have no aversion to butter. I&#8217;ve also been lacking in blog inspiration, and was thinking about trying to generate more posts. Finally, I recently saw Julie/Julia, and imitation being the highest form of [...]]]></description>
			<content:encoded><![CDATA[<p>Really, I like to cook anything, but specifically, I enjoy cooking French food. It doesn&#8217;t hurt that I love to eat and have no aversion to butter. I&#8217;ve also been lacking in blog inspiration, and was thinking about trying to generate more posts. Finally, I recently saw <i>Julie/Julia</i>, and imitation being the highest form of flattery, I&#8217;ve decided to blog about cooking, specifically my cooking.</p>
<p><span id="more-26"></span></p>
<p>First, if you&#8217;re local and know of a good place to buy fresh whole fish, I&#8217;m all ears. The best option I&#8217;ve found is to call Whole Foods. I&#8217;ve talked to a few people at their seafood counter, and inferred that they buy from one of a few sources locally that cater to restaurants and food markets. Seattle Fish Market in Denver is one of these places. You can&#8217;t, as an individual, purchase small quantities direct from these wholesale suppliers, but you can get it on buys through your local Whole Foods. Some caveats I&#8217;ve found are that you have to give them good lead time (at least a week) if you want something really specific, but they can often find something that will work for you on shorter notice. For example, this week I decided somewhat late in the game to make fish (for 4), and while I couldn&#8217;t get a whole 4 pound fish on short notice, I can get two 2-pounders. This isn&#8217;t really the same amount of meat (extra heads, bone, etc.), but it&#8217;s close enough for my plans since I was a little heavy on the serving side with a single 4 pounder (3/4 to 1lb per person is a good rule of thumb for whole fish unless it&#8217;s a weird variety that is extra bone-y or extra meat-y). Plus, I can always make dessert or another small course to make up for it, which adds work for me, the cook, but if you find cooking joyful, that&#8217;s not really a problem.</p>
<p>A couple short words about French food: it&#8217;s easy. If your mental imagery of French cooking is tiny portions artfully served for very high prices, well, that&#8217;s a bit sad. It&#8217;s true that that particular style of presentation-heavy, palate-targeted cooking is a lovely and enjoyable art form, but it doesn&#8217;t detract from the bulk of provincial French food enjoyed by all the social classes in that country for centuries. So anyway, here&#8217;s a meal I&#8217;m planing for this weekend. Future posts will get straight to the cookery, but hey, it&#8217;s my blog and I can pretentiously describe French cuisine if I like before getting to the meat of the post. Get it? The mea&#8230; yeah. Anyway.</p>
<p>I&#8217;ll be poaching fish (snapper) with a julienne vegetable medley and sauce <i>parisienne</i>, which like most French sauces is just a variation on one of the basic sauces, in this case a <i>velouté</i> made with fish stock and having cream and egg yolks added. If I wanted to be super pretentious I could call this <i>Filets de poisson a la parisienne</i>. The vegetable medley will be potatoes, carrots, and probably shallots or maybe a leek, something fairly classic that pairs with sauced fish. Here&#8217;s roughly what I plan to do.</p>
<p>Acquire, scale, and gut the fish, then remove the fillets and de-bone. I&#8217;ll also be getting some extra fish trim from Whole Foods (bones, heads - probably halibut). All the trim goes to making fish stock in white wine vinegar. The fish stock also becomes the poaching liquid and the base for the <i>velouté</i> and ultimately the sauce. All the prep and stock work comes earlier in the day. When cooking time approaches, I&#8217;ll go ahead and julienne the vegetables, then season and cook them. Next, put the fillets in a baking dish, add the vegetables and season the dish overall. In goes the fish stock, which then goes into the oven for poaching. After it&#8217;s done, the poaching liquid comes out into a saucepan and turned into <i>velouté</i>, then sauce <i>parisienne</i>. Plate, add sauce, some nice crusty bread, and pair with a good white wine. I could also brown the sauced fish slightly, maybe adding bread crumbs, and then I could tell people they&#8217;re eating the very impressive sounding <i>Filets de poisson gratin a la parisienne</i>.</p>
<p>If I&#8217;m feeling ambitious for dessert, I don&#8217;t think you can ever <b>really</b> go wrong with creme brulee, and it&#8217;s an easy addition if you don&#8217;t mind making caramel. It also gives me an excuse to check out a new spice shop I learned about courtesy <a href="http://talltara.com/">Tara</a>, the Savory Spice Shop in Boulder.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leftwise.com/2009/12/17/i-like-to-cook/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The darkness comes&#8230;</title>
		<link>http://blog.leftwise.com/2009/07/10/the-darkness-is-spreading/</link>
		<comments>http://blog.leftwise.com/2009/07/10/the-darkness-is-spreading/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 20:21:02 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
		
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.leftwise.com/?p=25</guid>
		<description><![CDATA[This post is for friends who I&#8217;m running a local Call of Cthulthu game with.

Almost 3 years have passed since the farmhouse incident, and while the investigators have found tantalizing clues and references buried deep in library archives to the sarcophagus and Marion Allen&#8217;s method of death, the trail has gone cold and no definitive [...]]]></description>
			<content:encoded><![CDATA[<p>This post is for friends who I&#8217;m running a local Call of Cthulthu game with.</p>
<p><span id="more-25"></span></p>
<p>Almost 3 years have passed since the farmhouse incident, and while the investigators have found tantalizing clues and references buried deep in library archives to the sarcophagus and Marion Allen&#8217;s method of death, the trail has gone cold and no definitive answers have been found. However, the investigators&#8217; efforts have not been in vain; characters who played through the farmhouse incident have gained skills over the past few years during their studies and made important contacts among other scholars, researchers, and mystics, some of whom may become allies - or liabilities - in future investigations.</p>
<p>With a particular interest in Egyptology and the occult, all the members of the team remember the ill-fated Carlyle Expedition. Even laypersons can recall details of playboy Roger Carlyle&#8217;s well-publicized journey into inner Egypt in 1919, subsequent safari into Africa, and the eventual massacre of the expedition by death-cults in the remote interior of that country.</p>
<p>It&#8217;s not until now - 1925 - that one of <a href="http://raukusbaukus.com/">Thurber Upton</a>&#8217;s close correspondents begins to draw a tenuous link between the Carlyle expedition and Upton&#8217;s strange tale, but the link may lead our investigators to knowledge both forbidden, dangerous, and of a scale they could not have imagined.</p>
<p><i>Note: Players have received a private link to handouts with background material on the Carlyle Expedition in preparation for our next session. Players playing investigators who survived the farmhouse horror will receive a skill point bonus, to distribute as they choose, for skills they may have gained during the (2+ year) intermission between that and this scenario. Dates from the last scenario have been retconned to a few years earlier to prevent me from having to update dates on supplements for the next adventure.</p>
<p>A small skill point bonus will be awarded to players who can spot the video game reference in this post without using Google.<br />
</i></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leftwise.com/2009/07/10/the-darkness-is-spreading/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Edge of Darkness</title>
		<link>http://blog.leftwise.com/2009/07/01/the-edge-of-darkness/</link>
		<comments>http://blog.leftwise.com/2009/07/01/the-edge-of-darkness/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 23:16:49 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
		
		<category><![CDATA[Games]]></category>

		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.leftwise.com/?p=24</guid>
		<description><![CDATA[This post is a summary of a Call of Cthulthu session I ran with some friends last month. It&#8217;s intended as an introduction for new players at our next session, or a refresher to the players from the last session. A subsequent post will introduce important background for the next game.

At the deathbed of respected [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a summary of a Call of Cthulthu session I ran with some friends last month. It&#8217;s intended as an introduction for new players at our next session, or a refresher to the players from the last session. A subsequent post will introduce important background for the next game.</p>
<p><span id="more-24"></span></p>
<p>At the deathbed of respected Misaktonic University literature professor Rupert Merriweather, 4 of the professor&#8217;s acquaintances met and learned the professor&#8217;s secret: years earlier, he and a group of 5 other naive students, under the guidance of an older mentor, Marion Allen, formed a group dedicated to the study of spirits and the occult, called the Dark Brotherhood. After several failures, a new artifact (and associated ritual) provided by Allen gave the group its first and last success: they were able to summon an otherwordly Thing in a farmhouse outside Allen&#8217;s Corners, Massachusetts, which promptly beheaded one member of the group and drove the other insane.</p>
<p>Fleeing in terror, the group concocted a plausible story for the death of one member (and the catatonic insanity of the other) and vowed never to speak of the night&#8217;s events again. Nearly 40 years later, as Dr. Merriweather reached the final stages of terminal lung cancer, he summoned the 4 investigators to his hospital room, knowing that after his death any binding magic on the Thing would fade and it would be free to roam the countryside, unchecked. Giving them Marion Allen&#8217;s artifact and journal notes from the Dark Brotherhood, he urged them to help dispel the Thing he had so recklessly summoned years before.</p>
<p>The 4 investigators were drawn from various backgrounds, linked only by their mutual acquaintance to Dr. Merriweather. They included:</p>
<ul>
<li><b><a target="_blank" href="http://raukusbaukus.com/">Thurber Upton</a></b>, a veteran and former battlefield medic, handy in a pinch with a revolver and schooled in the treatment of the serious physical trauma likely to be encountered in a war zone. Equally at home shooting a hobo through the femoral artery or treating the wound to prevent him from dying.</li>
<li><b><a target="_blank" href="http://jiujitsukit.com/">Stanley Clark</a></b>, snake-oil salesman extraordinaire, skilled in the art of misdirection, persuasion, and outright lying. Claims to have sucessfully sold an icebox to an Eskimo acquaintance. Valuable when you need a diversion, to convince someone to take a cheap bribe, or a shot of an &#8220;all-natural, fantastic, homeopathic elixir to cure hair loss, vapors, the gout, and rickets&#8221;.</li>
<li><b><a target="_blank" href="http://mikebucks.com/">Cale Graves</a></b>, a businessman who operates a successful bookstore dealing in rare volumes, while drawing the bulk of his finances from a private (and equally successful) bootlegging operation. Having both legitimate and illegitimate business, Graves possesses a wide variety of skills, including a working knowledge of chemistry from his bootlegging business as well as unparalled library research skills gathered while establishing a successful rare book emporium.</li>
<li><b><a target="_blank" href="http://bethtaylorphoto.com/">Dr. Thelonius Doom</a></b>, academic and respected professor of Psychology at Miskatonic University, skilled with ancient languages and gifted with a working knowledge of the fledgling skill of Clinical Psychiatry.</li>
</ul>
<p>The investigators accepted Dr. Merriweather&#8217;s request and handily succeeded in dispatching the Thing lurking in the farmhouse attic. Along the way, the investigators explained the disappearance of Maggie McPhirter, local farmer&#8217;s wife, ensuring her soul could rest at peace when Cale Graves destroyed her reanimated body with a shotgun blast at close range. An unlucky hobo, Red Jake, had a more frantic meeting with the investigators, and ultimately sealed his own fate after bolting from the protection of the farmhouse to be subsequently killed and reanimated by the Thing and then killed <b>again</b> by a second blast from Graves&#8217; trusty boomstick.</p>
<p>Over the course of the investigation, the group discovered several odd pieces of information that continue to defy explanation. While most of the original Dark Brotherhood died after the farmhouse incident due to natural causes, Marion Allen&#8217;s case was not so simple. During the investigation, the group discovered that the existence of the mysterious artifact Allen provided to the group, a small Egyptian sarcophagus originally containing an insect trapped in amber, was not a secret known only to the Brotherhood:</p>
<ol>
<li>Before Allen&#8217;s death, he complained to police that he was being pursued by a group bent on recovering the artifact.
</li>
<li>Soon after, his body was found near the docks, his clothing showing signs of being in or near a fire, and his tongue cut out with a sharp-bladed knife.</li>
<li>Strangely, neither the fire nor a bladed weapon were the cause of his death; the coroner was unable to find a definitive cause, citing foul play via coronary arrest, induced by unknown means.</li>
</ol>
<p><center><img src="http://www.leftwise.com/misc/artifact.jpg" alt="Curious artifact" /></center></p>
<p>The artifact itself is now safely locked in Cale Graves&#8217; safe, although since the creature once contained in it has been dispelled, it possesses no occult properties. However, it is still a curious and valuable piece of antiquity, being made of solid gold. In the course of their investigation, the group learned the following facts about the artifact:</p>
<ol>
<li>The inscription on the artifact&#8217;s case is Middle Egyptian, cryptically referring to a &#8220;Seeker of Wisdom&#8221;; after translation, the text is best represented in English as:<br />
<blockquote><pre>"Seeker of Wisdom, Servant of Yoag Setheth,
Deliverer of the people of the water,
Bearer of the spirits of Nyar-loth-hotep,
child of Thoth, Seeker of Wisdom."
</pre>
</blockquote>
</li>
<li>Another inscription on the inside of the artifact&#8217;s lid is not Egyptian at all, nor is it a language any of the investigators can identify, despite thorough attempts with the aid of local libraries and academics. As best as they can identify, the language is similar to script found on artifacts that are claimed by less-reputable scholars to be from the ancient continent of Mu, said to be the location of fictional lost cultures such as Atlantis.</li>
</ol>
<p>Returning to Boston after dispatching the Thing (and respectfully disposing of the rather messy remains of Maggie and Red Jake), the members of the group struggle to understand and explain what they saw in the farmhouse. </p>
<p>Unable to let the mystery rest, some begin to search for clues to the history of the artifact and how a mere dilettante in the occult like Marion Allen came to possess it&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leftwise.com/2009/07/01/the-edge-of-darkness/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dear The Internet</title>
		<link>http://blog.leftwise.com/2009/05/21/dear-the-internet/</link>
		<comments>http://blog.leftwise.com/2009/05/21/dear-the-internet/#comments</comments>
		<pubDate>Fri, 22 May 2009 01:34:01 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
		
		<category><![CDATA[Meta]]></category>

		<guid isPermaLink="false">http://blog.leftwise.com/?p=23</guid>
		<description><![CDATA[Let&#8217;s talk. I know we haven&#8217;t spoken much lately, but I&#8217;m ready now. The thing is, we&#8217;ve changed. We used to fit together so well. Everything about you was new and exciting to me. You completed my sentences. You helped me discover all sorts of fun things I never knew about. You were an eloquent [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s talk. I know we haven&#8217;t spoken much lately, but I&#8217;m ready now. The thing is, we&#8217;ve changed. We used to fit together so well. Everything about you was new and exciting to me. You completed my sentences. You helped me discover all sorts of fun things I never knew about. You were an eloquent and knowledgeable partner. You opened the world up to me. And who could forget those steamy nights? </p>
<p>But lately, we&#8217;ve been distant. To be honest, you&#8217;ve become a little shrill. I spend a lot of time now just trying to filter all of the stuff you spew at me every day. You&#8217;ve always been a little slangy and cliquish, but I have to admit that I&#8217;m beginning to honestly despise what you&#8217;re doing to the English language. Because I hang out with you all the time, I have to put up with it, but honestly, can you try to control yourself a little bit?</p>
<p>You&#8217;re caught up in fads. I don&#8217;t want to gossip all the time, and I don&#8217;t need to know the minutiae of all your friends&#8217; lives. How do you even have that many friends? Why are you telling me what some girl you went to kindergarten with is going to see at the movies tonight? You talk an awful lot, but say little. I think you&#8217;re giving me ADD, if such a thing is possible. It&#8217;s always little soundbites with you. You can&#8217;t talk about a single topic for more than 30 seconds.</p>
<p>So I think we need to go on a break for a little while. I&#8217;ve&#8230; I&#8217;ve decided to read some books and stay away from you for a while. Look, I know we have to see each other at work, and I know I can read books on you too, it&#8217;s just&#8230; I need some space. Let&#8217;s just try to be adults about this. It&#8217;s only a few novels, and maybe, a little nonfiction. Just give me some time. We can work this out. Wait, why are you laughing? What do you mean, ironic?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.leftwise.com/2009/05/21/dear-the-internet/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
