<?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>Steve Cooper</title>
	<atom:link href="http://www.stevecooper.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stevecooper.org</link>
	<description>Programming, writing, programming about writing.</description>
	<pubDate>Mon, 14 Apr 2008 12:20:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>A lisp macro virgin tells all</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/</link>
		<comments>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 18:13:28 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[lisp]]></category>

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

		<guid isPermaLink="false">http://www.stevecooper.org/?p=57</guid>
		<description><![CDATA[I finished my first lisp macro, and I want to tell the world.

I&#8217;ll talk about what a lisp macro is, and what makes it unique in the world of programming, how it&#8217;s a technique only possible in lisp. I&#8217;ll then take you through an example.

So firstly, what&#8217;s a lisp macro, and why would you want [...]]]></description>
			<content:encoded><![CDATA[<p>I finished my first lisp macro, and I want to tell the world.</p>

<p>I&#8217;ll talk about what a lisp macro is, and what makes it unique in the world of programming, how it&#8217;s a technique only possible in lisp. I&#8217;ll then take you through an example.</p>

<p>So firstly, what&#8217;s a lisp macro, and why would you want to write one?</p>

<p>So, you may have seen lisp programs before, and you&#8217;ll recognise them instantly &#8212; Larry Wall, the inventor of <a href="http://www.perl.com/">Perl</a>, said they had all the aesthetic appeal of a bowl of porridge mixed with toenail clippings;</p>

<pre><code>(defun accumulate (combiner lst initial)
  (let ((accum initial))
    (dolist (i lst)
      (setf accum (funcall combiner accum i)))
    accum))
</code></pre>

<p>He has a point. They are butt-ugly. But hell, the best he came up with is <a href="http://www.perl.com/">Perl</a>, so he can <code>$_@++</code> right off. (I&#8217;m pretty sure that&#8217;s valid Perl, too <img src='http://www.stevecooper.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</p>

<p>It&#8217;s ugly, in an aesthetic way, but it&#8217;s amazingly practical. It&#8217;s got an engineering beauty to it. If you look at that snippet above, you&#8217;ll notice that the whole program is made out of exactly three types of symbols;</p>

<ul>
<li>open parenthesis: <code>(</code></li>
<li>close parenthesis: <code>)</code></li>
<li>symbols, like <code>defun</code>, <code>accum</code> and <code>setf</code></li>
</ul>

<p>All simple lisp programs are like this. Just brackets to group stuff together, and stuff that needs grouping. Compare that with C#, where you might find;</p>

<ul>
<li>parenthesis for;

<ul>
<li>function calls; <code>print("hello")</code></li>
<li>special forms; <code>using(OdbcConnection con = ...)</code></li>
</ul></li>
<li>semi-colon to end statements; <code>int x = 1;</code></li>
<li>curly brackets for; 

<ul>
<li>code blocks; <code>{ /* code block */ }</code></li>
<li>array initialisers; <code>string[] words = { &#8220;hello&#8221;, &#8220;world&#8221; };</code></li>
</ul></li>
<li>square brackets for array indexing; <code>x[3] = 4</code>;</li>
</ul>

<p>and the list goes on. I gave up because there are too many to list.</p>

<p>So lisp has this seriously small syntactic footprint. You can have a thing, or a group of things in brackets. It&#8217;s simple. It&#8217;s <em>so</em> simple that you can start doing crazy stuff in lisp that you just can&#8217;t do otherwise. That crazy stuff goes by the name of macros.</p>

<p>I can write a program that takes a chunk of lisp (remember, just a thing or a list of things), cuts it up, and reassembles it. That creates new lisp code.</p>

<p>So imagine you do a lot of work on three-dimensional arrays. You find yourself, over and over, writing nested loops that say;</p>

<pre><code>for x in range(100):
    for y in range(100):
        for z in range(100):
            # do something to matrix[x,y,z]
</code></pre>

<p>And frankly, you&#8217;re bored of typing it over and over. What you really want to do is something like;</p>

<pre><code>for {x 100, y 100, z 100}:
    # do something to matrix[x,y,z]
</code></pre>

<p>You want a brand new bit of syntax for multiple-value looping. Can you add it to python? Nope. C? Nope. Java? Nope.</p>

<p>But now look at the lisp version;</p>

<p>I could, theoretically, write this</p>

<pre><code>(domanytimes (x 100 y 100 z 100) 
    body)
</code></pre>

<p>and, because it&#8217;s just a list of stuff, I can chop and change that into this new bit of lisp;</p>

<pre><code>(dotimes (x 100)
    (dotimes (y 100)
        (dotimes (z 100)
            body)))
</code></pre>

<p>I&#8217;ll show you how in a second, but notice what&#8217;s possible &#8212; I can write my own looping construct (<code>domanytimes</code>) and lisp will rewrite it into many simpler looping construct (the built-in <code>dotimes</code>).</p>

<p>Is that particularly special? Well, yeah. I&#8217;ve written new syntax. I&#8217;ve defined a new way of looping that is no different from the standard loops. I&#8217;ve basically added something new to the language. Lisp is now better at dealing with multi-dimensional loops. Try adding a new loop to ruby, or javascript. Make python understand</p>

<pre><code>for x in range(100), y in range(100), z in range(100):
      # body here 
</code></pre>

<p>and you&#8217;ll find you can&#8217;t.</p>

<p>So I&#8217;ve made my version of lisp a bit better at handling loops. If I were writing database code, I could make lisp better at writing SQL statements or data access layers. C# recently got built-in DAL logic with <a href="http://msdn2.microsoft.com/en-gb/netframework/aa904594.aspx">LINQ</a>, and it&#8217;s great, but only the C# team can write it. Whereas a lisper could write this sort of code;</p>

<pre><code>(sql-select (ID NAME) from PROJECT where (DUEDATE &gt; TODAY))
</code></pre>

<p>and it&#8217;s do basically the same thing as <a href="http://msdn2.microsoft.com/en-gb/netframework/aa904594.aspx">LINQ</a>.</p>

<p>So that&#8217;s the why&#8217;s and wherefores. Here&#8217;s the how of the <code>domanytimes</code> macro.</p>

<p><code>domanytimes</code> takes two parts; the loop variables <code>(x 100 y 100 z 100)</code> and whatever body you want to execute. We&#8217;re going to write a program that skims two elements from the front of the loop variables (say, <code>x</code> and <code>100</code>) and uses them to write a built-in <code>dotimes</code> loop; so a program which converts</p>

<pre><code>(domanytimes (x 100 y 100) body)
</code></pre>

<p>into</p>

<pre><code>(dotimes (x 100) 
   (domanytimes (y 100) body))
</code></pre>

<p>and then again to give you</p>

<pre><code>(dotimes (x 100)
    (dotimes (y 100)
        body))
</code></pre>

<p>Here&#8217;s the <code>domanytimes</code> macro, in all it&#8217;s eye-bleeding horror;</p>

<pre><code>(defmacro domanytimes (loop-list &amp;body body)
  "allows you to write (domanytimes (x 10 y 10) ...) 
  instead of (dotimes (x 10) (dotimes (y 10)) body ))"
  (if (eq (length loop-list) 0)
      ;; we have our form to execute
      `(progn ,@body)
      ;; we have more loops to arrange
      (let ((fst (car loop-list))
        (snd (cadr loop-list))
        (rst (cddr loop-list)))
    `(dotimes (,fst ,snd)
      (domanytimes ,rst ,@body)))))
</code></pre>

<p>There. Wasn&#8217;t that fun? <img src='http://www.stevecooper.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<p>It looks nasty, I know. All lisp looks nasty. But it&#8217;s actually created something new in the language. As far as I understand it, lisp has survived for fifty years basically because the macro system lets you write macros which can add any new kind of syntax you like. You can write knock up a set of macros to <a href="http://en.wikipedia.org/wiki/CLOS">implement OO</a>, and suddenly lisp is OO. You can know up macros for manipulating lazy lists, and suddenly lisp has a <a href="http://en.wikipedia.org/wiki/Lazy_evaluation">lazy evaluation</a>. You can knock up data access layer macros, and it&#8217;s got a version of <a href="http://msdn2.microsoft.com/en-gb/netframework/aa904594.aspx">LINQ</a>. There seems to be nothing you can&#8217;t hack lisp into being.</p>

<p>And if you want to know how the hell that works, I&#8217;d recommend <a href="http://gigamonkeys.com/book/">Practical Common Lisp</a>, which is online and free.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Five languages for talking about programs.</title>
		<link>http://www.stevecooper.org/2008/04/07/five-languages-for-talking-about-programs/</link>
		<comments>http://www.stevecooper.org/2008/04/07/five-languages-for-talking-about-programs/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 18:41:42 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stevecooper.org/?p=53</guid>
		<description><![CDATA[Only one of which is a computer programming language.

At work, we&#8217;re designing a new product. It&#8217;s a process that involves non-technical users, IT managers, programming colleagues, me, and the computer. It involves a lot of talking, a lot of language. At one end, it&#8217;s making sure the users are happy with the system&#8217;s capabilities. While [...]]]></description>
			<content:encoded><![CDATA[<p>Only one of which is a computer programming language.</p>

<p>At work, we&#8217;re designing a new product. It&#8217;s a process that involves non-technical users, IT managers, programming colleagues, me, and the computer. It involves a lot of talking, a lot of language. At one end, it&#8217;s making sure the users are happy with the system&#8217;s capabilities. While talking to them, we use non-technical language, diagrams, and demonstrations. Way at the other, it&#8217;s actually typing code.</p>

<p>This makes me think it might be useful to split the languages we&#8217;re talking into four;</p>

<p><strong>User Langage:</strong> Non-technical, example-laden, visual, and concrete. This is where you get into general discussions, produce photoshop mockups of the system, draw rough-and-ready whiteboard pictures, write XP user stories, write user manuals.</p>

<p><strong>Manager Language:</strong> Your manager needs to know the technical and algorithmic overview, but he doesn&#8217;t need to see every class that&#8217;s going into the design. This language is the language of high-level functional specs, some UML diagrams, conceptual diagrams.</p>

<p><strong>Colleage Language:</strong> At this level, you&#8217;re going to have to assure yourself that the code you write and the code your colleagues write start meshing together. Precision starts being important, and a real burden. Probably where most of the real thinking goes on. I think one of the reasons Pair Programming works is because it forces you to get into a lot more of these types of discussion, which reduces the possibility that the team&#8217;s work won&#8217;t gel together.</p>

<p><strong>Self Language:</strong> This is the idiosyncratic, outboard-brain style of writing that you get into to make sure you understand what you need to be doing. This can be personal pseudocode, notes-to-self, todo lists, or code comments.</p>

<p><strong>Computer Language:</strong> The code itself.</p>

<p>I think a great deal of the actual design and thinking involved in creating new products goes on above the level of the computer language. When people discuss, say, &#8220;Python Vs Java&#8221; or &#8220;Ruby vs Lisp&#8221;, it&#8217;s valuable enough, but the choice of language probably isn&#8217;t that important in determining the success of the project. I think these language strata go some way to explaining why. Most of the communication goes on between people.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stevecooper.org/2008/04/07/five-languages-for-talking-about-programs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Modifying large codebases in dynamic and static languages</title>
		<link>http://www.stevecooper.org/2008/04/05/modifying-large-codebases-in-dynamic-and-static-languages/</link>
		<comments>http://www.stevecooper.org/2008/04/05/modifying-large-codebases-in-dynamic-and-static-languages/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 00:47:31 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[c#]]></category>

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

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

		<guid isPermaLink="false">http://www.stevecooper.org/?p=56</guid>
		<description><![CDATA[I&#8217;ve been wondering recently about dynamic languages, and static languages, and the relative benefits.

I&#8217;m struggling with this question because I write C#3 by day, and am learning python in the evenings. I&#8217;m only writing small python scripts at the moment and I&#8217;d like to write larger pieces, but I&#8217;m concerned about how easy it&#8217;ll be [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been wondering recently about dynamic languages, and static languages, and the relative benefits.</p>

<p>I&#8217;m struggling with this question because I write C#3 by day, and am learning python in the evenings. I&#8217;m only writing small python scripts at the moment and I&#8217;d like to write larger pieces, but I&#8217;m concerned about how easy it&#8217;ll be to make certain types of change.</p>

<p>For example. You&#8217;ve got 100,000 lines of code. You also have a logging function that&#8217;s looks like this;</p>

<pre><code>void Log(string message)
</code></pre>

<p>And it&#8217;s called about 200 times in your code. You decide you need a severity; so you change the signature to</p>

<pre><code>void Log(string message, LoggingSeverity severity) { .. }
</code></pre>

<p>Now, how long does it take to find all the calls to the Log() function that need to be updated? Under C#, about ten seconds. Once every call has been fixed, the code is almost certain to work correctly.</p>

<p>Consider, on the other hand, the python function</p>

<pre><code>def log(message):
    ...
</code></pre>

<p>What happens if you change the signature to</p>

<pre><code>def log(message, severity):
    ...
</code></pre>

<p>There is no way to tell where the log message is called. You&#8217;ve just introduced 200 bugs.</p>

<p>It&#8217;s made even worse by duck typing; maybe you have two loggers &#8212; a deployment logger which writes to a database, and a test logger which writes to stdout. You update the database logger so it has severity. Your tests continue to pass, but your deployed system will fail.</p>

<p>So it seems to me that static languages give you much more power to make changes to large codebases. I&#8217;d love to know if, and where, the mistakes are in my thinking.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stevecooper.org/2008/04/05/modifying-large-codebases-in-dynamic-and-static-languages/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Du Hast Milch</title>
		<link>http://www.stevecooper.org/2008/03/20/du-hast-milch/</link>
		<comments>http://www.stevecooper.org/2008/03/20/du-hast-milch/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 09:54:56 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stevecooper.org/2008/03/20/du-hast-milch/</guid>
		<description><![CDATA[

German advert for milk, with the tagline &#8220;Hard types need hard bones… drink milk!&#8221;

link
]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.stevecooper.org/wp-content/uploads/2008/03/milch-ch.jpg' title='Du Hast Milch'><img src='http://www.stevecooper.org/wp-content/uploads/2008/03/milch-ch.jpg' alt='Du Hast Milch' /></a></p>

<p>German advert for milk, with the tagline &#8220;Hard types need hard bones… drink milk!&#8221;</p>

<p><a href="http://coilhouse.net/2008/03/19/du-du-hast-du-hast-milch/">link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stevecooper.org/2008/03/20/du-hast-milch/feed/</wfw:commentRss>
		</item>
		<item>
		<title>IObit SmartDefrag &#8212; windows program to defrag drives</title>
		<link>http://www.stevecooper.org/2008/02/23/iobit-smartdefrag-windows-program-to-defrag-drives/</link>
		<comments>http://www.stevecooper.org/2008/02/23/iobit-smartdefrag-windows-program-to-defrag-drives/#comments</comments>
		<pubDate>Sat, 23 Feb 2008 11:39:27 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[software]]></category>

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

		<guid isPermaLink="false">http://www.stevecooper.org/2008/02/23/iobit-smartdefrag-windows-program-to-defrag-drives/</guid>
		<description><![CDATA[For the last few months, I&#8217;ve been using IObit SmartDefrag. It
is a freeware defrag program that keeps your drive running
fast. Basically, you install it and it runs in the background, like a
librarian silently alphabetising your book collection. Your machine
can find and load files faster. Anyway, it feels like my machine has
stayed fast, where I would [...]]]></description>
			<content:encoded><![CDATA[<p>For the last few months, I&#8217;ve been using <a href="http://www.iobit.com/iobitsmartdefrag.html">IObit SmartDefrag</a>. It
is a freeware defrag program that keeps your drive running
fast. Basically, you install it and it runs in the background, like a
librarian silently alphabetising your book collection. Your machine
can find and load files faster. Anyway, it feels like my machine has
stayed fast, where I would have expected it to slow down over
time. Anyway, it&#8217;s freeware, it seems to be reliable, and it&#8217;s kept my
machine fast. Can&#8217;t go wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stevecooper.org/2008/02/23/iobit-smartdefrag-windows-program-to-defrag-drives/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hoverboards for sale.</title>
		<link>http://www.stevecooper.org/2008/02/21/hoverboards-for-sale/</link>
		<comments>http://www.stevecooper.org/2008/02/21/hoverboards-for-sale/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 19:52:54 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stevecooper.org/2008/02/21/hoverboards-for-sale/</guid>
		<description><![CDATA[Y&#8217;know, I love living in the future.

Take, for example, this hoverboard;



Yes, that&#8217;s right. A hoverboard. For about seven grand, from these guys
]]></description>
			<content:encoded><![CDATA[<p>Y&#8217;know, I love living in the future.</p>

<p>Take, for example, this hoverboard;</p>

<p><a href='http://www.stevecooper.org/wp-content/uploads/2008/02/airboardshop.jpg' title='hoverboard'><img src='http://www.stevecooper.org/wp-content/uploads/2008/02/airboardshop.jpg' alt='hoverboard' /></a></p>

<p>Yes, that&#8217;s right. A hoverboard. For about seven grand, from <a href="http://www.powerscoots.co.uk/acatalog/Airboard.html">these guys</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stevecooper.org/2008/02/21/hoverboards-for-sale/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Stephen Fry, blogging and podcasting</title>
		<link>http://www.stevecooper.org/2008/02/20/stephen-fry-blogging-and-podcasting/</link>
		<comments>http://www.stevecooper.org/2008/02/20/stephen-fry-blogging-and-podcasting/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 11:30:06 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[blogging]]></category>

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

		<guid isPermaLink="false">http://www.stevecooper.org/2008/02/20/stephen-fry-blogging-and-podcasting/</guid>
		<description><![CDATA[So, just in case you didn&#8217;t know about Mr Fry&#8217;s blog and new podcast &#8212; you&#8217;ve been told.
]]></description>
			<content:encoded><![CDATA[<p>So, just in case you didn&#8217;t know about Mr Fry&#8217;s <a href="http://stephenfry.com/blog">blog</a> and new <a href="http://www.stephenfry.com/podcasts/">podcast</a> &#8212; you&#8217;ve been told.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stevecooper.org/2008/02/20/stephen-fry-blogging-and-podcasting/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Impractical, Uncommon Lisp.</title>
		<link>http://www.stevecooper.org/2008/02/13/impractical-uncommon-lisp/</link>
		<comments>http://www.stevecooper.org/2008/02/13/impractical-uncommon-lisp/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 18:02:44 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stevecooper.org/2008/02/13/impractical-uncommon-lisp/</guid>
		<description><![CDATA[A friend of mine, Rob Ahrens, asked me how my learning of the
programming language Lisp was going. I thought I&#8217;d respond in an open
letter.

Um, Hi, Rob.

I have two previous posts on lisp, A programming language only a mother could love, and lisp, the beautiful hydra.

Childhood Nightmares

When I&#8217;ve had time, I&#8217;ve been attempting the problems in [...]]]></description>
			<content:encoded><![CDATA[<p>A friend of mine, Rob Ahrens, asked me how my learning of the
programming language Lisp was going. I thought I&#8217;d respond in an open
letter.</p>

<p>Um, Hi, Rob.</p>

<p>I have two previous posts on lisp, <a href="http:2007/04/02/a-programming-language-only-a-mother-could-love/">A programming language only a mother could love</a>, and <a href="http:2008/01/21/lisp-the-beautiful-hydra/">lisp, the beautiful hydra</a>.</p>

<h2>Childhood Nightmares</h2>

<p>When I&#8217;ve had time, I&#8217;ve been attempting the problems in <a href="http://projecteuler.net/">Project
Euler</a>. Euler lays out a series of ~200 mathsy programming
puzzles, things like &#8216;find the sum of all the even-valued terms in the
Fibonacci sequence which do not exceed one million.&#8217; I&#8217;m using them as
a way of trying out the language. At my side, possibly the only decent
beginner&#8217;s book, <a href="http://www.gigamonkeys.com/book/">Practical Common Lisp</a>. (It&#8217;s also free.)</p>

<p>So far, I&#8217;ve finished 2 problems. Hmm. I&#8217;m pretty sure I could have
finished more of them, more quickly, in almost any other language.</p>

<p>That, I think, is at least in part that lisp doesn&#8217;t come naturally if
you&#8217;re used to non-lisp languages, things that bear a resemblance to C
or BASIC. I&#8217;m having to go right back to basics, learning to construct
things in a new way. Here&#8217;s the code I used to solve problem 2;</p>

<pre><code>(defun fibseq (max)
  (let ((result ())
        (n-1 1)
        (n-2 0)
        (term 0)
        (i 0))
    (loop
     (setf term (cond ((= i 0) 1)
                      ((= i 1) 1)
                      (T (+ n-1 n-2))))
     (setf n-2 n-1)
     (setf n-1 term)
     (setf i (1+ i))
     (when (&gt; term max) (return))
     (push term result))
    (print result)
    result))

(defparameter allfib (fibseq 1000000))
(defparameter evenfib (remove-if-not #'evenp allfib))

; the answer!
(print (reduce #'+ evenfib))
</code></pre>

<p>I don&#8217;t print this here to demonstrate the clarity of lisp. In fact,
the opposite. This looks like hell to me, at least right now. There
is, no doubt, a <em>far</em> better way to do this. But I don&#8217;t know, and so
I&#8217;m writing programs that are terribly inelegant. Nestled in the code
above is a non-terminating loop with a break condition, because I
couldn&#8217;t figure out how to do the equivalent of</p>

<pre><code>while (n &lt; 1000000)
{
</code></pre>

<p>Right now I feel like I did when I was ten, programming in BBC basic
and using GOTOs. Hell, it knocks together working programs, right? But
you don&#8217;t want to stay there too long. That feeling of childhood
programming, though&#8230; there&#8217;s something compelling in it. Lisp tastes
of nostalgia. Remember programming Logo? Or BASIC? Lisp is making me
feel like that. At least for now.</p>

<p>Pretty soon, I hope to have mastered basic loops. Then I&#8217;ll be well on
my way.</p>

<h2>(setq <em>subject</em> (list &#8216;( &#8216;)))</h2>

<p>Or, now I will talk about parentheses.</p>

<p>In my head, despite being entirely uncomfortable with <code>while</code> loops,
I&#8217;m starting to see everything falling into a lisp syntax. The idea of
just bracketing up your stuff into lists seems like a great
first-draft syntax for <em>everything</em> &#8212; want to talk about data
structures? write</p>

<pre><code>(data
  (entity1 (attribute1 attribute2))
  (entity2 (attribute3 attriubte4)))
</code></pre>

<p>want to write pseudocode for a function call?</p>

<pre><code>(func (param1 param2) ...)
</code></pre>

<p>want to write a todo list?</p>

<pre><code>(do 
  (buy bread)
  (tidy (kitchen living-room bathroom))
  (get life))
</code></pre>

<p>Valentines day coming up?</p>

<pre><code> (get-count
     (make-list #'(lambda (i thee) 
                          (permute #'love i thee))))
</code></pre>

<p>Ok. Maybe not. (apologies to Elizabeth Browning there.)</p>

<p>But you get my point. I hope. Those brackets are just fine for
<em>everything</em>. I&#8217;m starting to understand why hardcore lispers want to
do everything in lisp. My brain is infected with brackets.</p>

<p>But for right now? I&#8217;m going to learn to do a <code>for</code> loop, and then
we&#8217;ll see.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stevecooper.org/2008/02/13/impractical-uncommon-lisp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Samurai Dog Armour</title>
		<link>http://www.stevecooper.org/2008/02/11/samurai-dog-armour/</link>
		<comments>http://www.stevecooper.org/2008/02/11/samurai-dog-armour/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 21:20:23 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stevecooper.org/2008/02/11/samurai-dog-armour/</guid>
		<description><![CDATA[

Fun oddness; Samurai Dog Armour


  This suit of dog armor — identified by antique Japanese armor dealer Toraba.Com as the only known and certified authentic example of its kind — is believed to have been created for the pet of a wealthy, high-ranking and presumably eccentric samurai or daimyo (feudal lord) in the mid [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.stevecooper.org/wp-content/uploads/2008/02/samurai_dog_armor_1.jpg' title='samurai_dog_armor_1.jpg'><img src='http://www.stevecooper.org/wp-content/uploads/2008/02/samurai_dog_armor_1.jpg' alt='samurai_dog_armor_1.jpg' /></a></p>

<p>Fun oddness; <a href="http://feeds.feedburner.com/~r/PinkTentacle/~3/233241950/">Samurai Dog Armour</a></p>

<blockquote>
  <p>This suit of dog armor — identified by antique Japanese armor dealer Toraba.Com as the only known and certified authentic example of its kind — is believed to have been created for the pet of a wealthy, high-ranking and presumably eccentric samurai or daimyo (feudal lord) in the mid to late Edo period (mid-18th to mid-19th century)</p>
</blockquote>

<p><a href="http://feeds.feedburner.com/~r/PinkTentacle/~3/233241950/">link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stevecooper.org/2008/02/11/samurai-dog-armour/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The pleasure of single-tasking</title>
		<link>http://www.stevecooper.org/2008/02/08/the-pleasure-of-single-tasking/</link>
		<comments>http://www.stevecooper.org/2008/02/08/the-pleasure-of-single-tasking/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 19:25:54 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
		
		<category><![CDATA[life hacks]]></category>

		<guid isPermaLink="false">http://www.stevecooper.org/2008/02/08/the-pleasure-of-single-tasking/</guid>
		<description><![CDATA[Over Christmas, I spent six and a half hours driving from York to
Pembrokeshire, to stay with Clare&#8217;s parents. What should have been a
hellish drive was significantly more pleasant than expected. I&#8217;m going
to talk about why, and make a wider point about life hacks.

Long-distance driving, especially somewhere you&#8217;ve never been before,
can often be nasty. You have [...]]]></description>
			<content:encoded><![CDATA[<p><em>Over Christmas, I spent six and a half hours driving from York to
Pembrokeshire, to stay with Clare&#8217;s parents. What should have been a
hellish drive was significantly more pleasant than expected. I&#8217;m going
to talk about why, and make a wider point about life hacks.</em></p>

<p>Long-distance driving, especially somewhere you&#8217;ve never been before,
can often be nasty. You have to juggle several things at once &#8211;
planning the route, controlling the car, talking to your passengers,
etc &#8212; and you have time pressure, too. For me, this means stress.</p>

<p>Two things, I think, made the journey much more pleasant;</p>

<ol>
<li>I drove an automatic,</li>
<li>I used GPS to navigate.</li>
</ol>

<p>This offloaded several tasks from my brain; I no longer had to plan a
route; everything was handed to me in simple-to-follow
left/right/straight on choices, and if I made a mistake (which I did a
couple of times) the GPS just routed round it, giving me a new route
which got me there.</p>

<p>The automatic gearbox also made things easier. That part of my brain
that would normally be making sure I was in the right gear was no
longer occupied.</p>

<p>Life was simpler, so life was sweeter.</p>

<p>Joel, of the <a href="http://www.joelonsoftware.com/">&#8216;Joel on Software&#8217;</a> site, uses the analogy of
automatic transmissions when he talks about some <a href="http://www.joelonsoftware.com/articles/APIWar.html">benefits for
programmers</a> (scroll to &#8216;Automatic Transmission Wins
the Day&#8217;). The wider point really is that freeing up your mind from
one type of detail is like juggling with one fewer ball; it&#8217;s much,
much easier.</p>

<p>So this is my wider point; anything fully automatic (I mean really and
truly don&#8217;t-make-me-think automatic) makes your life less stressful.</p>

<p>The flipside, of course, is control. You always sacrifice a little
control to the system. You lose precise throttle control in an
automatic car. You lose control of exactly what stocks you own if you
buy an index-tracker ISA.</p>

<p>I think this scares people, but really shouldn&#8217;t &#8212; this level of
detail will probably tire you, stress you, and give very little
benefit over the automatic method.</p>

<p>I&#8217;ll finish with a fantastic quote from <a href="http://en.wikipedia.org/wiki/Alfred_North_Whitehead">Alfred North Whitehead</a>,
co- author of the <a href="http://en.wikipedia.org/wiki/Principia_Mathematica">Principia Mathematica</a>;</p>

<blockquote>
  <p>It is a profoundly erroneous truism, repeated by all copy books and
  by eminent people when they are making speeches, that we should
  cultivate the habit of thinking of what we are doing. The precise
  opposite is the case. Civilization advances by extending the number of
  important operations which we can perform without thinking about them.
  Operations of thought are like calvary charges in a battle–they are
  strictly limited in number, they require fresh horses, and must only
  be made at decisive moments.</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.stevecooper.org/2008/02/08/the-pleasure-of-single-tasking/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
