<?xml version="1.0" encoding="iso-8859-1" ?>
<rss version="0.92">
<channel>
	<docs>http://backend.userland.com/rss092</docs>
	<title>GDR</title>
	<link>http://gamedevelopersrefuge.org//</link>
	<description>Game Developer's Refuge</description>
	<managingEditor>GDR@nuclearplayground.com</managingEditor>
	<webMaster>GDR@nuclearplayground.com</webMaster>
	<lastBuildDate>Sun, 05 Sep 2010 17:33:23 GMT</lastBuildDate>
<item>
	<title>Things old games have taught you</title>
	<link>http://gamedevelopersrefuge.org/viewtopic.php?p=25454#25454</link>
	<description>Author: &lt;a href=&quot;http://gamedevelopersrefuge.org//profile.php?mode=viewprofile&amp;u=3&quot; target=&quot;_blank&quot;&gt;Sirocco&lt;/a&gt;&lt;br /&gt;
Subject: Things old games have taught you&lt;br /&gt;
Posted: Sat Sep 04, 2010 12:08 pm (GMT -8)&lt;br /&gt;
Topic Replies: 0&lt;br /&gt;&lt;br /&gt;
&lt;span class="postbody"&gt;Looking back at some old games I enjoyed playing, I have to admit they have taught me some harsh lessons. There will be spoilers galore in this post, and likely a dash of profanity, but I'm going to detail moments in gaming that drove me batshit insane, to the point where I never want to make those mistakes in my own games.
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;1. Unannounced limitations are evil in long games - King's Quest 2 &amp;amp; 4&lt;/span&gt;
&lt;br /&gt;

&lt;br /&gt;
I have a love/hate relationship with all the King's Quest games I've ever played. I love them because they can be charming, technically astounding for their time, and full of crazy shit, but it's hard to love a game series that punches you in the junk at almost every given opportunity. The worst of these moments come when the game gives you an odd limitation, and either deliberately or accidentally fails to tell you about it. Two cases in point: the bridge in KQ2, and the shovel in KQ4. The bridge in KQ2 is particularly nasty, as it lets you cross it seven times before collapsing, and you need to cross it no less than seven times to finish the game. So, if you wander over the bridge even once to &quot;see if anything has changed&quot;, you're hosed... and you won't realize it until you're at the end of the game and unable to cross the bridge that one last time. In KQ4, there is a shovel that is only good for five uses, and you need to dig up exactly five graves to finish the game. After five uses the shovel will break. You see where this is going, right? Also, how about that golden bridle? You know, the one that is hidden on an island that you can never return to? Yeah, you remember that, don't you, you sadistic whore! There's a special place in hell reserved for Roberta Williams, and I'll be there... merrily flaying the skin from her bones for all eternity. I may even do it with a golden bridle, just to make my point clear.
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;2. If there's an item I require to finish the game, don't let me lose or waste it - Ultima Underworld 1 &amp;amp; 2, Obitus&lt;/span&gt;
&lt;br /&gt;

&lt;br /&gt;
Ultima Underworld was an astounding game for its time. No doubt. It was also a mofo because it couldn't be completed unless you gathered a bunch of special items and used them to perform a ceremony at the end of the game. But... and I'm sure you know where this is going... it's entirely possible to lose the items permanently. For example, not knowing that I needed a particular book, I was doing some inventory management at the bottom of the dungeon and accidentally tossed it into a lava-filled chasm. I thought it had landed on the ledge next to me, but it skipped off into the nether regions of the game. Books don't float on lava, you know. I thought things were kosher, and went about my business, until I got to the end and realized I was hosed to the max. Fuck me.
&lt;br /&gt;

&lt;br /&gt;
Lightning struck twice with Ultima Underworld 2, where you need to have a flask of basilisk oil to complete a ceremony required to complete the game. There's only two flasks in the whole damn game, and the game doesn't note what the flask is good for until you need it, so it's easy to drink in the heat of battle and forget about. I figured it would have some sort of defensive effect, and also figured I could get some more. Like I said, there's one other flask, and it's a huge pain in the ass to find, even when someone tells you where it is. If you somehow lose both, you're hosed. Totally hosed. Fortunately, this time I located the second flask and went about the business of finishing the game, but in the back of my mind I always told myself the game's designers had attempted to assrape me, and missed by a just little bit, brutally poking my taint instead. Not a good feeling, man.
&lt;br /&gt;

&lt;br /&gt;
In Obitus, there are bosses that can only be killed by using special and purposefully rare magic powders of varying strength. Use the wrong powder on the wrong boss and you'll never finish the game. 
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;3. Timed events in adventure games is a staggeringly bad idea - Rise of the Dragon, Dark Seed&lt;/span&gt;
&lt;br /&gt;

&lt;br /&gt;
So I need to buy some flowers to progress in the game, but the flower girl is only around for one day, then never seen again in the game. Also, I might need a stick, that I get while visiting my neighbor at 5 P.M. on one specific day, where he's playing fetch with his dog. If I miss that, I'm forever hosed. After all, it's not like I can just walk by any tree and get a branch off it, right? RIGHT? If you think either of these scenarios is appropriate, and think the approach would make for a fun game, please give me your address so I can stop by and fuck you with a rake before you can ruin the lives of so many people.
&lt;br /&gt;
 
&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;4. Arbitrary death is not a fun thing - Pretty much any game Sierra ever made, now that I think about it&lt;/span&gt;
&lt;br /&gt;

&lt;br /&gt;
Space Quest and Police Quest were probably the kings of arbitrary death (perhaps giving an honorable mention to The Immortal), taking sadistic delight in ending your game for making the slightest wrong move, or hosing you because you did something like hop in your squad car without doing the 360 degree safety inspection (I'm not joking, either). I've always felt that death in games should be something you can see coming, even if it's inevitable. There's something immensely saddening about realizing that you've just saved the game right after doing something that will result in a game over with 100% certainty, and haven't had the foresight or OCD to make multiple saves. Police Quest taught me that lesson: save often, and rotate your save slots, because the guy who designed the game you're playing just might be a motherfucker. Monkey Island 1 make fun of Sierra by having a sequence late in the game where Guybrush can &lt;a href=&quot;http://www.youtube.com/watch?v=ENeRZEnn2Fc&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;accidentally fall off a cliff.&lt;/a&gt; This pops up a Sierra-inspired &quot;You've died! Restart. Reload. Quit!&quot; prompt for just a moment, before seeing the hero fly back up onto the ledge. He makes a joke about landing on a rubber tree, but we all know the joke was on Sierra for being such unrepentant dickweeds. 
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;5. Sometimes less is more - Final Fantasy VI&lt;/span&gt;
&lt;br /&gt;

&lt;br /&gt;
I was replaying FF6 for, oh I dunno, the umpteenth time, when I was struck by how nonabrasive the game's dialogue was. It was a little cheesy at times, but the game never drifted into &quot;full emo&quot; mode like it did during 7, 8, 9, 10, and sometimes 12. Space limitations worked their magic, and while the game is stuffed to the brim with places to go and things to see, it doesn't have the space to wander through immense emo or metaphysical diatribes that plague many jRPGs. There is one, and only one, moment if self indulgence on the part of the creators, where the entire cast of player characters go all sappy and explain why their lives have meaning. It's still short compared to even a single conversation in modern games, and to top it off the final boss chides them for sounding like chapters from a self-help booklet, before launching an all-out attack. Many times I play RPGs to explore, and kick ass. Overly indulgent, droning exposition isn't something I relish.
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;6. Those other guys were good, but I'm the best bad guy I'll ever face - Ultima IV&lt;/span&gt;
&lt;br /&gt;

&lt;br /&gt;
In Ultima IV you are the only bad guy. Yes, you. You'll be in a full-on battle against your evil, self-serving proclivities, and the game will be throwing a gauntlet at you that requires you to abstain from all the stuff you normally do in RPGs. No stealing, no cheating, no overkill, no cowardly behavior, no backstabbing, no self aggrandizing, and absolutely, positively, NO MURDER. The sick point is that the game makes it easy to do all these things, often to the point of actually encouraging the behaviors it holds against you. Needless to say, I had a bit of a spell with this one. &lt;span style=&quot;font-style: italic&quot;&gt;&quot;What's that, you say I'm supposed to give money to the beggars? Oh shit man, I've been killing them instead!&quot;&lt;/span&gt;.
&lt;br /&gt;

&lt;br /&gt;
Yeah, whoops. Still, it was the best &quot;boss battle&quot; I've ever faced. And the battle lasted the entire game, at that. Top that. I dare you!
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;7. Save points are good - Many, many games of all shapes and sizes&lt;/span&gt;
&lt;br /&gt;

&lt;br /&gt;
Please, please, pretty please with sugar, whipped cream, a cherry, and three lines of cocaine on top, give me a save point before I take on a boss battle.
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;8. I want to finish your game. Really, I do - Pretty much any Psygnosis game ever, Data East c64 ports&lt;/span&gt;
&lt;br /&gt;

&lt;br /&gt;
Psygnosis was staffed by sadists. As developers, and publishers, they strove to provide the most unfair, ball-busting entertainment to be found on any platform. When you absolutely, positively, couldn't bear the thought of actually finishing a game you paid good money for, look no further! As a hidden bonus, the PC ports of their games were often harder than their Amiga counterparts. Baal, Stryx, Obliterator, Shadow of the Beast (any), Agony, Blood Money... the list is long indeed. Data East also provided much fodder for masochists with the c64 ports of their arcade games. These were largely impossible to beat by anyone who wasn't an idiot savant. 
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;9. Difficulty should make a steady rise, not form a cliff or mountain - Drakkhen&lt;/span&gt;
&lt;br /&gt;

&lt;br /&gt;
Drakkhen was one of those rare games that fucked me so hard I just couldn't get enough, even when I was bleeding out both ears and missing half of my left asscheek. The game was designed to eliminate your party in under three minutes of starting a game. Normally you wouldn't survive you first random encounter, and even if you did there were numerous game-ending monsters lurking nearby to finish the job. Every enemy in the game was present and ready to rumble at the very start of the game, so you were frequently beset by enemies that could wipe out your party in a single hit. For most of the game, survival is quite a chore... so much so that I'd wager most people didn't get beyond the game's initial few minutes before tossing it in the garbage. To add insult to injury, the PC version didn't come with a map, so you had to wander the map (and you started in a random location, too!) looking for safe harbors, but you would likely die before you found anything. It was a miserable game, but it looked so good (for its time) and featured some very cool effects, so I suffered many nights at its hands.
&lt;br /&gt;_________________&lt;br /&gt;&lt;span style=&quot;font-size: 9px; line-height: normal&quot;&gt;Ask not for whom the telephone bell tolls... if thou art in the bathtub, it tolls for thee. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
</description>
</item>
<item>
	<title>Sorting Algorithms</title>
	<link>http://gamedevelopersrefuge.org/viewtopic.php?p=25276#25276</link>
	<description>Author: &lt;a href=&quot;http://gamedevelopersrefuge.org//profile.php?mode=viewprofile&amp;u=4&quot; target=&quot;_blank&quot;&gt;Bean&lt;/a&gt;&lt;br /&gt;
Subject: Sorting Algorithms&lt;br /&gt;
Posted: Sat Aug 21, 2010 12:45 am (GMT -8)&lt;br /&gt;
Topic Replies: 29&lt;br /&gt;&lt;br /&gt;
&lt;span class="postbody"&gt;I'm sure most of you are familiar with one or two sorting methods. Here's a couple kickass videos that apply sound to various algorithms with a nice visual so you can see how each one works.
&lt;br /&gt;

&lt;br /&gt;
&lt;object width=&quot;480&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/t8g-iYGHpEA?fs=1&amp;amp;hl=en_US&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/t8g-iYGHpEA?fs=1&amp;amp;hl=en_US&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;480&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;br /&gt;

&lt;br /&gt;
&lt;object width=&quot;480&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/iXAjiDQbPSw?fs=1&amp;amp;hl=en_US&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/iXAjiDQbPSw?fs=1&amp;amp;hl=en_US&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;480&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
-Bean
&lt;br /&gt;_________________&lt;br /&gt;&lt;a href=&quot;http://nuclearplayground.com&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;Nuclear Playground&lt;/a&gt; | &lt;a href=&quot;http://www.vholdr.com/users/bean&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;VholdR&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
</description>
</item>
<item>
	<title>Google does a PC (browser) app store</title>
	<link>http://gamedevelopersrefuge.org/viewtopic.php?p=25244#25244</link>
	<description>Author: &lt;a href=&quot;http://gamedevelopersrefuge.org//profile.php?mode=viewprofile&amp;u=7&quot; target=&quot;_blank&quot;&gt;PoV&lt;/a&gt;&lt;br /&gt;
Subject: Google does a PC (browser) app store&lt;br /&gt;
Posted: Wed Aug 18, 2010 9:25 am (GMT -8)&lt;br /&gt;
Topic Replies: 21&lt;br /&gt;&lt;br /&gt;
&lt;span class="postbody"&gt;Your required reading for this:
&lt;br /&gt;

&lt;br /&gt;
&lt;a href=&quot;http://www.1up.com/news/google-shows-future-browser-games&quot; target=&quot;_blank&quot;&gt;http://www.1up.com/news/google-shows-future-browser-games&lt;/a&gt;
&lt;br /&gt;

&lt;br /&gt;
- 5% processing fee (you keep 95%)
&lt;br /&gt;
- No approval process
&lt;br /&gt;
- Launches October 2010 (US Currency Only)
&lt;br /&gt;

&lt;br /&gt;
Yarg!  I need to dust off my Native Client Smiles port now... not to mention figure out how to bypass the stupid &quot;No Canadians can Sell&quot; problem.  :|
&lt;br /&gt;_________________&lt;br /&gt;&lt;span style=&quot;font-style: italic&quot;&gt;Mike Kasprzak&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;Sykhronics Entertainment&lt;/span&gt; | &lt;a href=&quot;http://smiles-game.com&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;Smiles&lt;/a&gt; (iPhone, Palm Pre, PC/Netbook, Nokia N900, Bada, WM), &lt;a href=&quot;http://smileshd.com&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;Smiles HD&lt;/a&gt; (iPad), ??? (2012) | &lt;a href=&quot;http://toonormal.com&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;Blog&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
</description>
</item>
<item>
	<title>Your Dream Game Scripting Language?</title>
	<link>http://gamedevelopersrefuge.org/viewtopic.php?p=25062#25062</link>
	<description>Author: &lt;a href=&quot;http://gamedevelopersrefuge.org//profile.php?mode=viewprofile&amp;u=126&quot; target=&quot;_blank&quot;&gt;xearthianx&lt;/a&gt;&lt;br /&gt;
Subject: Your Dream Game Scripting Language?&lt;br /&gt;
Posted: Thu Aug 05, 2010 3:11 am (GMT -8)&lt;br /&gt;
Topic Replies: 63&lt;br /&gt;&lt;br /&gt;
&lt;span class="postbody"&gt;There's a lot of scripting languages out there. Games have come to use them extensively as the demand for interactive content expands, and blurs the lines between data and code. For simplicity, familiarity, and sometimes I'm sure pure laziness, game devs often pick off-the-shelf languages, such as Lua, Python, LISP, etc. But none of these are really geared toward making games. Even the languages that are written for and packaged with games and engines often feel like scaled-back general purpose computation languages with a few hooks into engine services, rather than a solution custom-built specifically for the two tasks a game scripting language is ostensibly meant to facilitate: very fast dynamic programming, and handling common game management tasks.
&lt;br /&gt;

&lt;br /&gt;
So what would the features of your dream game scripting language be? Here are a few loose guilde lines (not rules!) I think most of us can agree upon, to get us started:
&lt;br /&gt;
&lt;ol type=&quot;1&quot;&gt;&lt;li&gt;Super easy to embed and interface with native types and functions - in both directions
&lt;br /&gt;
&lt;li&gt;Garbage collection is a must - a script is not the place to be juggling memory allocations (unless you're using it to manage memory pools for your C code)
&lt;br /&gt;
&lt;li&gt;Expressivity and succinctness trump runtime efficiency - the point is to program high level logic quickly; leave engine programming for compiled languages
&lt;br /&gt;
&lt;li&gt;Ease of use and simplicity trump comprehensiveness - if generics or diamond inheritance or switch statements make it harder to use, leave them out!
&lt;br /&gt;
&lt;li&gt;Games oriented, not engine oriented - you want the feature set to apply to managing games in general, not cater to a particular engine's data or functions
&lt;br /&gt;
&lt;li&gt;Interactive, dynamic access - tweak any value or function, anywhere, at any time without any recompilation step
&lt;br /&gt;
&lt;li&gt;Optional persistence across sessions - what good is it to tune in that elusive sweet spot value in-game if you lose your results when you exit?
&lt;br /&gt;
&lt;li&gt;Think outside the box - what are the best and worst things about languages you know, and how can you exploit this knowledge with zany, domain-specific constructs?&lt;/ol&gt;
&lt;br /&gt;
I have a slew of ideas for designing a scripting language that generally follows the above philosophy. I'll start posting them to this thread. But I want to know what kinds of unusual syntax and features you have always wanted (or never knew you wanted until you sat down to think about it). Like a Huffman encoding, the most common tasks should require the least typing. Ultimately, I think it would be super awesome to have a GDR scripting language that we can all use for our games, though I'm not sure how realistic that is for a lot of reasons. In the mean time, however, it is at least a useful and fun thought-exercise.
&lt;br /&gt;_________________&lt;br /&gt;&lt;span style=&quot;font-size: 9px; line-height: normal&quot;&gt;&amp;lt;earthian&amp;gt; why should I have to think? that's what the computor box is for
&lt;br /&gt;
&amp;lt;madgarden&amp;gt; Yes, except computers can't think either. D'oh!
&lt;br /&gt;
&amp;lt;madgarden&amp;gt; WE'RE SO FSCKED!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
</description>
</item>
<item>
	<title>July 26 Downtime</title>
	<link>http://gamedevelopersrefuge.org/viewtopic.php?p=24924#24924</link>
	<description>Author: &lt;a href=&quot;http://gamedevelopersrefuge.org//profile.php?mode=viewprofile&amp;u=4&quot; target=&quot;_blank&quot;&gt;Bean&lt;/a&gt;&lt;br /&gt;
Subject: July 26 Downtime&lt;br /&gt;
Posted: Tue Jul 27, 2010 9:55 am (GMT -8)&lt;br /&gt;
Topic Replies: 2&lt;br /&gt;&lt;br /&gt;
&lt;span class="postbody"&gt;Last night HostGator had one of those catastrophic moments that I'm sure all hosts/datacenters dread.
&lt;br /&gt;
I'm not sure exactly what happened but they had about 50 servers go down. Apparently something happened with a building. http, databases, ftp, e-mail, everything was gone.
&lt;br /&gt;

&lt;br /&gt;
And once again HostGator proved to me why they fuckin kick ass.
&lt;br /&gt;
Their techs went into emergency holy-shit mode and got things handled They also had a huge team of customer service people ready to explain things and assist their customers. And they were honest about it all. No PR bullshit. And these guys were responding to e-mails, phone and online live chat. How many times have you tried to use another company's live chat only to be greated with an error message or a &quot;sorry were closed&quot; message. This was 2am and HostGator had almost 40 reps on there!
&lt;br /&gt;
It took then a few hours to do what a lot of companies would have spent days working on. The GDR database took a little longer but they got that fresh out of the oven too (so we didn't have to use one of my oldass backups).
&lt;br /&gt;

&lt;br /&gt;
Most of you probably didn't even know the site was down and that I was scrambling for solutions. And that's a good thing.
&lt;br /&gt;
So this is just me doing a lil ass kiss for HostGator because I really haven't dealt with many companies as awesome as they are.
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
-Bean
&lt;br /&gt;_________________&lt;br /&gt;&lt;a href=&quot;http://nuclearplayground.com&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;Nuclear Playground&lt;/a&gt; | &lt;a href=&quot;http://www.vholdr.com/users/bean&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;VholdR&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
</description>
</item>
<item>
	<title>Revitalizing Game Design</title>
	<link>http://gamedevelopersrefuge.org/viewtopic.php?p=24901#24901</link>
	<description>Author: &lt;a href=&quot;http://gamedevelopersrefuge.org//profile.php?mode=viewprofile&amp;u=126&quot; target=&quot;_blank&quot;&gt;xearthianx&lt;/a&gt;&lt;br /&gt;
Subject: Revitalizing Game Design&lt;br /&gt;
Posted: Mon Jul 26, 2010 10:41 am (GMT -8)&lt;br /&gt;
Topic Replies: 7&lt;br /&gt;&lt;br /&gt;
&lt;span class="postbody"&gt;Thoughtful blog on the thematic rut of current game design trends. Of course, this will always be less of an issue in the indie scene, where large corporate concerns will have less of a limiting effect on plot and game mechanics. But the viewpoint he puts forward should be useful in pushing creativity that extra notch that might just mean the difference between obscurity and success.
&lt;br /&gt;

&lt;br /&gt;
&lt;a href=&quot;http://www.gamasutra.com/blogs/ChristopherTotten/20100726/5636/The_Importance_of_Research_Getting_the_Best_of_Postmodern_Design.php&quot; target=&quot;_blank&quot;&gt;http://www.gamasutra.com/blogs/ChristopherTotten/20100726/5636/The_Importance_of_Research_Getting_the_Best_of_Postmodern_Design.php&lt;/a&gt;
&lt;br /&gt;_________________&lt;br /&gt;&lt;span style=&quot;font-size: 9px; line-height: normal&quot;&gt;&amp;lt;earthian&amp;gt; why should I have to think? that's what the computor box is for
&lt;br /&gt;
&amp;lt;madgarden&amp;gt; Yes, except computers can't think either. D'oh!
&lt;br /&gt;
&amp;lt;madgarden&amp;gt; WE'RE SO FSCKED!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
</description>
</item>
<item>
	<title>BSP info and tutorials</title>
	<link>http://gamedevelopersrefuge.org/viewtopic.php?p=24848#24848</link>
	<description>Author: &lt;a href=&quot;http://gamedevelopersrefuge.org//profile.php?mode=viewprofile&amp;u=126&quot; target=&quot;_blank&quot;&gt;xearthianx&lt;/a&gt;&lt;br /&gt;
Subject: BSP info and tutorials&lt;br /&gt;
Posted: Fri Jul 23, 2010 4:20 pm (GMT -8)&lt;br /&gt;
Topic Replies: 6&lt;br /&gt;&lt;br /&gt;
&lt;span class="postbody"&gt;I am currently in a Computational Geometry / Geometric Algorithms course. I needed to to figure out a term project, and attached myself to someone who wanted to do Bounding Volume Hierarchies. After a bit of poking around, we realized that to a first approximation, there is zero information about some of the implementation details (google for &quot;treepsila&quot;, I dare you!) Thus, I suggested we switch to BSP trees, for which there is TONS of information out there, and gigabytes of source code to reference if needed.
&lt;br /&gt;

&lt;br /&gt;
So my question: What are some &lt;span style=&quot;font-style: italic&quot;&gt;exceptionally good&lt;/span&gt; websites, online tutorials, books (bonus points if it's available as a pdf), or open source software projects that might make the subject clear and easy to understand? The textbook covers the subject, but is generally rather dense, and their pseudocode style sucks pretty bad. Any links that you already know are legit and would save me from hours upon hours of trawling through braindead websites and inscrutable journal articles would be appreciated++.
&lt;br /&gt;_________________&lt;br /&gt;&lt;span style=&quot;font-size: 9px; line-height: normal&quot;&gt;&amp;lt;earthian&amp;gt; why should I have to think? that's what the computor box is for
&lt;br /&gt;
&amp;lt;madgarden&amp;gt; Yes, except computers can't think either. D'oh!
&lt;br /&gt;
&amp;lt;madgarden&amp;gt; WE'RE SO FSCKED!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
</description>
</item>
<item>
	<title>The &amp;quot;Useful Dev Tools&amp;quot; thread</title>
	<link>http://gamedevelopersrefuge.org/viewtopic.php?p=24796#24796</link>
	<description>Author: &lt;a href=&quot;http://gamedevelopersrefuge.org//profile.php?mode=viewprofile&amp;u=3&quot; target=&quot;_blank&quot;&gt;Sirocco&lt;/a&gt;&lt;br /&gt;
Subject: The &amp;amp;quot;Useful Dev Tools&amp;amp;quot; thread&lt;br /&gt;
Posted: Wed Jul 21, 2010 7:23 am (GMT -8)&lt;br /&gt;
Topic Replies: 27&lt;br /&gt;&lt;br /&gt;
&lt;span class="postbody"&gt;We don't have one of there already, do we? I searched...
&lt;br /&gt;

&lt;br /&gt;
Any way, this is the thread for letting folks know about cool dev tools you're come across. Work smarter, not harder!
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
Here's a few I've been using:
&lt;br /&gt;

&lt;br /&gt;
&lt;a href=&quot;http://www.topshareware.com/Kiwi-Log-Viewer-%28Win%29-download-48314.htm&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;Kiwi Log Viewer&lt;/a&gt; - Freeware
&lt;br /&gt;

&lt;br /&gt;
This is a standard real time log file viewer. You fire up your program, then let this app monitor the log file, and it will automatically update and scroll as things change. Good for those times when you don't have a console window to push messages to. 
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;a href=&quot;http://freshmeat.net/projects/cppcheck&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;CppCheck&lt;/a&gt; - Freeware (WIP)
&lt;br /&gt;

&lt;br /&gt;
I've talked about this briefly in a previous thread. It's a semi-functional program that steps through a C++ project and makes note of some obvious problems you may have that might slip past your compiler. Right now it's mostly good for picking up memory leaks and unused variables. It needs more work before I'd classify it as an essential app.
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;a href=&quot;http://www.codeproject.com/KB/applications/difftool.aspx&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;Diff Tool&lt;/a&gt; and &lt;a href=&quot;http://winmerge.org/&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;WinMerge&lt;/a&gt; - Freeware
&lt;br /&gt;

&lt;br /&gt;
Diff Tool is a supremely lightweight and simplistic code difference comparison tool. That's all it does. If you want to do diff + merge, you need something like WinMerge instead. Meld looks interesting on the Linux side, but I can't attest to it as I'm not a Linux user at the moment.
&lt;br /&gt;_________________&lt;br /&gt;&lt;span style=&quot;font-size: 9px; line-height: normal&quot;&gt;Ask not for whom the telephone bell tolls... if thou art in the bathtub, it tolls for thee. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
</description>
</item>
<item>
	<title>Android App Inventor</title>
	<link>http://gamedevelopersrefuge.org/viewtopic.php?p=24676#24676</link>
	<description>Author: &lt;a href=&quot;http://gamedevelopersrefuge.org//profile.php?mode=viewprofile&amp;u=4&quot; target=&quot;_blank&quot;&gt;Bean&lt;/a&gt;&lt;br /&gt;
Subject: Android App Inventor&lt;br /&gt;
Posted: Mon Jul 12, 2010 7:42 pm (GMT -8)&lt;br /&gt;
Topic Replies: 11&lt;br /&gt;&lt;br /&gt;
&lt;span class="postbody"&gt;This looks like it could be good.
&lt;br /&gt;

&lt;br /&gt;
&lt;a href=&quot;http://appinventor.googlelabs.com/about/&quot; target=&quot;_blank&quot;&gt;http://appinventor.googlelabs.com/about/&lt;/a&gt;
&lt;br /&gt;

&lt;br /&gt;
It might be awhile before I've got a chance to try it but it's definitely something I'm interested in. If anyone else messes with it, let us know how it is!
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
-Bean
&lt;br /&gt;_________________&lt;br /&gt;&lt;a href=&quot;http://nuclearplayground.com&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;Nuclear Playground&lt;/a&gt; | &lt;a href=&quot;http://www.vholdr.com/users/bean&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;VholdR&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
</description>
</item>
<item>
	<title>Okay, it's time for the talk.</title>
	<link>http://gamedevelopersrefuge.org/viewtopic.php?p=24536#24536</link>
	<description>Author: &lt;a href=&quot;http://gamedevelopersrefuge.org//profile.php?mode=viewprofile&amp;u=56&quot; target=&quot;_blank&quot;&gt;Ninkazu&lt;/a&gt;&lt;br /&gt;
Subject: Okay, it's time for the talk.&lt;br /&gt;
Posted: Sat Jul 03, 2010 11:00 am (GMT -8)&lt;br /&gt;
Topic Replies: 45&lt;br /&gt;&lt;br /&gt;
&lt;span class="postbody"&gt;There are those of you who swear by C/C++, maybe Java or Python. I'm starting this thread to introduce a new possibility. Not necessarily a new language, but an overlooked paradigm.
&lt;br /&gt;

&lt;br /&gt;
Functional programming.
&lt;br /&gt;

&lt;br /&gt;
This is a long post that's split into different sections. Feel free to peruse.
&lt;br /&gt;
1. Correctness of Programs
&lt;br /&gt;
2. Proof of Correctness
&lt;br /&gt;
3. I Don't Like Math - Is Functional Programming Still For Me?
&lt;br /&gt;
4. List Processing Axioms
&lt;br /&gt;

&lt;br /&gt;
I bring this up because of my experience in theorem proving and research in programming languages. So many cool ideas have been introduced by academia in the past 25 years that still go unnoticed because people want their pointer arithmetic.
&lt;br /&gt;
Pointers, as you all must know, 99.9% of the time they're used, cause headaches, rage and bugs. I'm not going to say they're not useful tools when used &quot;right,&quot; but they cause so much non-local behavior that reasoning about correctness of your program becomes an exercise of futility. What correctness means for C/C++ users, I don't know, since there is no such thing as C/C++ - just the idea. Compiler bugs mean new dialects of these languages. Their type system is claimed &quot;weakly typed,&quot; but really that just means it's unsound. Types mean nothing in these languages.
&lt;br /&gt;
Please, if you have a disciplined use of pointers, post about it so we may engage in a discussion about alternative safer methodologies.
&lt;br /&gt;

&lt;br /&gt;
That aside out of the way, I've found that my experience with functional programming has made me much more aware of writing stateful code. You know the pervasive assignment statements in imperative code? Most of the time they're unnecessary. They introduce the need for whole-program analysis to ensure proper behavior. Recursion is such a powerful tool that makes assignment almost unnecessary, and its mathematical basis is so closely linked with (structural) induction that reasoning about your code becomes much more straightforward.
&lt;br /&gt;

&lt;br /&gt;
Allow me to demonstrate. Let us first discuss what correctness means. 
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;text-decoration: underline&quot;&gt;Correctness of Programs&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
For pure (assignment-free) functional programs, functions are actual functions f(x) will always be the same value for every call. This means we can write simple (if inefficient) programs that we can agree are &quot;correct by inspection,&quot; and then prove our more efficient version produces the same values. This is what is called &quot;functionally equivalent.&quot; 
&lt;br /&gt;
If we instead are trying to model a data structure, we can write a simple version and our &quot;better&quot; version and come up with a map from one to the other. What must then be proved is that each interface after a change produces the same value. This is called &quot;observational equivalence.&quot; This is a little more complex, so here is an example:
&lt;br /&gt;

&lt;br /&gt;
First the simple implementation of a queue. True-listp means a chain of conses that end in NIL, e.g. (cons 1 (cons 2 (cons 3 nil))) = (list 1 2 3). The convention in LISP of adding &quot;p&quot; means that the function is Boolean, i.e. a predicate.
&lt;br /&gt;
Those of you unfamiliar with languages that have lists should refer to the end of this post where the behavior of each function is described axiomatically.
&lt;br /&gt;

&lt;br /&gt;
Abstract implementation:
&lt;br /&gt;
This models a queue as a list whose front is the beginning of the list, and whose back is the end of the list. Enqueueing means a linear operation. Slow. Enqueueing and dequeueing return modified copies of the queue that you would then use. 
&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;defun queue-absp &amp;#40;q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;true-listp q&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun enqueue-abs &amp;#40;e q&amp;#41;
&lt;br /&gt;
&amp;nbsp;&amp;#40;append q &amp;#40;list e&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun peek-abs &amp;#40;q&amp;#41;
&lt;br /&gt;
&amp;nbsp;&amp;#40;car q&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun dequeue-abs &amp;#40;q&amp;#41;
&lt;br /&gt;
&amp;nbsp;&amp;#40;cdr q&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun emptyp-abs &amp;#40;q&amp;#41;
&lt;br /&gt;
&amp;nbsp;&amp;#40;null q&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun newqueue-abs &amp;#40;&amp;#41;
&lt;br /&gt;
&amp;nbsp;nil&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;

&lt;br /&gt;
Complex implementation:
&lt;br /&gt;
This implementation is two lists. The first list is the enqueue list and the second list is the deque list. They are managed in the opposite order. Given a balanced spread of enqueues and dequeues, interaction is constant time.
&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;defun queuep &amp;#40;q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;and &amp;#40;consp q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;true-listp &amp;#40;car q&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;true-listp &amp;#40;cdr q&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun enqueue &amp;#40;e q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;cons &amp;#40;cons e &amp;#40;car q&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;cdr q&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun dequeue &amp;#40;q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if &amp;#40;null &amp;#40;cdr q&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;cons nil
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;cdr &amp;#40;reverse &amp;#40;car q&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#40;cons &amp;#40;car q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;cdr &amp;#40;cdr q&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun peek &amp;#40;q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if &amp;#40;null &amp;#40;cdr q&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;car &amp;#40;reverse &amp;#40;car q&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#40;car &amp;#40;cdr q&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun newqueue &amp;#40;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;cons nil nil&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun emptyp &amp;#40;q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;and &amp;#40;null &amp;#40;car q&amp;#41;&amp;#41; 
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;null &amp;#40;cdr q&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
Map between the two&amp;#58;
&lt;br /&gt;
&amp;#40;defun abs2complex &amp;#40;q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;cons nil q&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;defun complex2abs &amp;#40;q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;append &amp;#40;cdr q&amp;#41; &amp;#40;reverse &amp;#40;car q&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
The theorems that must hold &amp;#40;free variables are universally quantified&amp;#41;&amp;#58;
&lt;br /&gt;
&amp;#40;implies &amp;#40;queuep q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;equal &amp;#40;emptyp q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;emptyp-abs &amp;#40;complex2abs q&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;implies &amp;#40;queuep q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;queuep-abs &amp;#40;complex2abs q&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;implies &amp;#40;queuep q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;equal &amp;#40;enqueue e q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;enqueue-abs e &amp;#40;complex2abs q&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;implies &amp;#40;and &amp;#40;queuep q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;not &amp;#40;emptyp q&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;equal &amp;#40;dequeue q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;dequeue-abs &amp;#40;complex2abs q&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;implies &amp;#40;and &amp;#40;queuep q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;not &amp;#40;emptyp q&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;equal &amp;#40;peek q&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;peek-abs &amp;#40;complex2abs q&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;equal &amp;#40;complex2abs &amp;#40;newqueue&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;newqueue-abs&amp;#41;&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
And conversely with abs2complex and reversing the use of complex and abstract forms.
&lt;br /&gt;

&lt;br /&gt;
There are more complicated notions of correctness that I won't go into here, but if you're interested seek &quot;refinement maps.&quot; 
&lt;br /&gt;
I will talk about one more, and that is correctness by constraint, or properties that must hold.
&lt;br /&gt;
Consider what it means for a sorting algorithm to be correct. Actually for sorting, that turns out to be ambiguous due to the notion of stability (and order). Let us then consider a simpler domain - what does it mean for an ascending sort of integers to be correct? 
&lt;br /&gt;
Is it.. that the sort produces an ordered list? Let's define ordered list:
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;defun orderedp &amp;#40;lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if &amp;#40;and &amp;#40;consp lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;consp &amp;#40;cdr lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;and &amp;#40;&amp;lt;= &amp;#40;car lst&amp;#41; &amp;#40;car &amp;#40;cdr lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;orderedp &amp;#40;cdr lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; T&amp;#41;&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
This function says empty and singleton lists are sorted. If you're a list of 2 or more elements, your first element has to be less than or equal to your second element. We continue this down the line until the end.
&lt;br /&gt;
That sounds reasonable, right?
&lt;br /&gt;
Well then:
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;defun amazingsort &amp;#40;lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;list 1&amp;#41;&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
Is a correct sort. Er, not what we wanted. Oh ya, the lists have to have the same elements. Not only that, they have to have the same number of occurrences of each distinct element. Well that's just a permutation.
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;defun permutationp &amp;#40;lst1 lst2&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;cond &amp;#40;&amp;#40;atom lst1&amp;#41; &amp;#40;atom lst2&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;&amp;#40;atom lst2&amp;#41; NIL&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;t &amp;#40;and &amp;#40;in &amp;#40;car lst1&amp;#41; lst2&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;permutationp &amp;#40;cdr lst1&amp;#41; &amp;#40;delete1 &amp;#40;car lst1&amp;#41; lst2&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;#40;defun in &amp;#40;e lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if &amp;#40;consp lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;or &amp;#40;equal e &amp;#40;car lst&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;in e &amp;#40;cdr lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;NIL&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;#40;defun delete1 &amp;#40;e lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if &amp;#40;consp lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;if &amp;#40;equal e &amp;#40;car lst&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;cdr lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;cons &amp;#40;car lst&amp;#41; &amp;#40;delete1 e &amp;#40;cdr lst&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;lst&amp;#41;&amp;#41;&amp;nbsp; &amp;nbsp;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
That's a lot to think about, even for stateless programs. At least I can prove that insertion sort is a real sort.
&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;text-decoration: underline&quot;&gt;Proof of Correctness&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
Now most of you guys I'm sure are used to the more test-based methodology of ensuring (actually, convincing yourself of) correctness of your programs. You can't test /every/ input though. You can however use mathematical tools to prove that your program behaves how you mean it to under every possible input. What I'm about to show you is long and tedious, but guess what? It's so mechanical that there actually are mechanical theorem provers out there that can do this for you.
&lt;br /&gt;

&lt;br /&gt;
Let's say I want to prove insertion sort is correct. Let's start with a definition.
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;defun insert &amp;#40;e lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if &amp;#40;atom lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;list e&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;if &amp;#40;&amp;lt;= e &amp;#40;car lst&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;cons e lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;cons &amp;#40;car e&amp;#41; &amp;#40;insert e &amp;#40;cdr lst&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;#40;defun isort &amp;#40;lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if &amp;#40;atom lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; lst
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;insert &amp;#40;car e&amp;#41; &amp;#40;isort &amp;#40;cdr lst&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
Okay, so what do we want to prove here? First (orderedp (isort lst)) and next (permutationp lst (isort lst))
&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
By induction on the definition of isort, we must prove these two obligations&amp;#58;
&lt;br /&gt;
1. &amp;#40;implies &amp;#40;atom lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;orderedp &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
2. &amp;#40;implies &amp;#40;and &amp;#40;not &amp;#40;atom lst&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;orderedp &amp;#40;isort &amp;#40;cdr lst&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;orderedp &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
1. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;atom lst&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;#40;orderedp &amp;#40;isort lst&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of isort, H1&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;orderedp lst&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of orderedp, H1&amp;#125;
&lt;br /&gt;
&amp;nbsp; T
&lt;br /&gt;

&lt;br /&gt;
2. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;not &amp;#40;atom lst&amp;#41;&amp;#41;
&lt;br /&gt;
H2&amp;#41; &amp;#40;orderedp &amp;#40;isort &amp;#40;cdr lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;#40;orderedp &amp;#40;isort lst&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of isort, H1&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;orderedp &amp;#40;insert &amp;#40;car lst&amp;#41; &amp;#40;isort &amp;#40;cdr lst&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;insert is order-preserving / e = &amp;#40;car lst&amp;#41;, x = &amp;#40;isort &amp;#40;cdr lst&amp;#41;&amp;#41;, H2&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;T
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
That last step needs to be justified. What's e? What's x? They're the universally quantified (and thus I may instantiate them) variables in the &quot;insert is order-preserving&quot; lemma I will now prove.
&lt;br /&gt;
(implies (orderedp x)
&lt;br /&gt;
               (orderedp (insert e x)))
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
By induction on insert, I must prove
&lt;br /&gt;
1. &amp;#40;implies &amp;#40;and &amp;#40;orderedp x&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;atom x&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;orderedp &amp;#40;insert e x&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
2. &amp;#40;implies &amp;#40;and &amp;#40;orderedp x&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;not &amp;#40;atom x&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;&amp;lt;= e &amp;#40;car x&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;orderedp &amp;#40;insert e x&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
3. &amp;#40;implies &amp;#40;and &amp;#40;orderedp x&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;not &amp;#40;atom x&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;not &amp;#40;&amp;lt;= e &amp;#40;car x&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;orderedp &amp;#40;insert e &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;orderedp &amp;#40;insert e x&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
1. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;orderedp x&amp;#41;
&lt;br /&gt;
H2&amp;#41; &amp;#40;atom x&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;#40;orderedp &amp;#40;insert e x&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of insert, H2&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;orderedp &amp;#40;list e&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of orderedp&amp;#125;
&lt;br /&gt;
&amp;nbsp; T
&lt;br /&gt;

&lt;br /&gt;
2. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;orderedp x&amp;#41;
&lt;br /&gt;
H2&amp;#41; &amp;#40;not &amp;#40;atom x&amp;#41;&amp;#41;
&lt;br /&gt;
H3&amp;#41; &amp;#40;&amp;lt;= e &amp;#40;car x&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;#40;orderedp &amp;#40;insert e x&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of insert, H2, H3&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;orderedp &amp;#40;cons e x&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of orderedp, H1, H2, H3&amp;#125;
&lt;br /&gt;
&amp;nbsp; T
&lt;br /&gt;

&lt;br /&gt;
3. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;orderedp x&amp;#41;
&lt;br /&gt;
H2&amp;#41; &amp;#40;not &amp;#40;atom x&amp;#41;&amp;#41;
&lt;br /&gt;
H3&amp;#41; &amp;#40;not &amp;#40;&amp;lt;= e &amp;#40;car x&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
H4&amp;#41; &amp;#40;orderedp &amp;#40;insert e &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;#40;orderedp &amp;#40;insert e x&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of insert, H2, H3&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;orderedp &amp;#40;cons &amp;#40;car x&amp;#41; &amp;#40;insert e &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of orderedp, insert is a cons lemma&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;and &amp;#40;&amp;lt;= &amp;#40;car x&amp;#41; &amp;#40;car &amp;#40;insert e &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;orderedp &amp;#40;insert e &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;H4, propositional logic&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;&amp;lt;= &amp;#40;car x&amp;#41; &amp;#40;car &amp;#40;insert e &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;#91;Okay there are a couple things that could happen here. Either e is the first in the inserted list or not. We consider both cases&amp;#93;
&lt;br /&gt;
Case 1&amp;#58; &amp;#40;equal &amp;#40;car &amp;#40;insert e &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41; e&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;&amp;lt;= &amp;#40;car x&amp;#41; &amp;#40;car &amp;#40;insert e &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;Case hypothesis&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;&amp;lt;= &amp;#40;car x&amp;#41; e&amp;#41;
&lt;br /&gt;
= &amp;#123;H3&amp;#125;
&lt;br /&gt;
&amp;nbsp; T
&lt;br /&gt;

&lt;br /&gt;
Case 2&amp;#58; &amp;#40;not &amp;#40;equal &amp;#40;car &amp;#40;insert e &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41; e&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;&amp;lt;= &amp;#40;car x&amp;#41; &amp;#40;car &amp;#40;insert e &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of insert, insert is a cons lemma&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;&amp;lt;= &amp;#40;car x&amp;#41; &amp;#40;car &amp;#40;cons &amp;#40;car &amp;#40;cdr x&amp;#41;&amp;#41; &amp;#40;insert e &amp;#40;cdr &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;car/cons axiom&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;&amp;lt;= &amp;#40;car x&amp;#41; &amp;#40;car &amp;#40;cdr x&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;H1, definition of orderedp&amp;#125;
&lt;br /&gt;
&amp;nbsp; T
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
The insert is a cons lemma is easily shown by case analysis (every if branch returns a cons), so I won't show that proof.
&lt;br /&gt;

&lt;br /&gt;
The next theorem to prove is (permutationp lst (isort lst)), which is a little trickier.
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
By induction on permutationp, we have the following obligations
&lt;br /&gt;
1. &amp;#40;implies &amp;#40;atom lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;permutationp lst &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
2. &amp;#40;implies &amp;#40;and &amp;#40;not &amp;#40;atom lst&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;atom &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;permutationp lst &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
3. &amp;#40;implies &amp;#40;and &amp;#40;not &amp;#40;atom lst&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;not &amp;#40;atom &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;permutationp &amp;#40;cdr lst&amp;#41; &amp;#40;delete1 &amp;#40;car lst&amp;#41; &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;permutationp lst &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
It looks like I need to prove a connection between &amp;#40;atom &amp;#40;isort lst&amp;#41;&amp;#41; and &amp;#40;atom lst&amp;#41;, but this is simple so I'll just refer to this lemma&amp;#58;
&lt;br /&gt;
&amp;nbsp; &amp;#40;iff &amp;#40;atom lst&amp;#41; &amp;#40;atom &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
as isort-cons-preserving
&lt;br /&gt;

&lt;br /&gt;
1. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;atom lst&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;permutationp lst &amp;#40;isort lst&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of permutationp, H1&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;atom &amp;#40;isort lst&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of isort, H1&amp;#125;
&lt;br /&gt;
&amp;nbsp; T
&lt;br /&gt;

&lt;br /&gt;
2. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;not &amp;#40;atom lst&amp;#41;&amp;#41;
&lt;br /&gt;
H2&amp;#41; &amp;#40;atom &amp;#40;isort lst&amp;#41;&amp;#41;
&lt;br /&gt;
From these hypotheses I can derive NIL &amp;#123;isort-is-cons-preserving&amp;#125;, so since false implies anything, this is T.
&lt;br /&gt;

&lt;br /&gt;
3. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;not &amp;#40;atom lst&amp;#41;&amp;#41;
&lt;br /&gt;
H2&amp;#41; &amp;#40;not &amp;#40;atom &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
H3&amp;#41; &amp;#40;permutationp &amp;#40;cdr lst&amp;#41; &amp;#40;delete1 &amp;#40;car lst&amp;#41; &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;#40;permutationp lst &amp;#40;isort lst&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of permutationp, H1, H2&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;and &amp;#40;in &amp;#40;car lst&amp;#41; &amp;#40;isort lst&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;permutationp &amp;#40;cdr lst&amp;#41; &amp;#40;delete1 &amp;#40;car lst&amp;#41; &amp;#40;isort lst&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;H3, propositional logic&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;in &amp;#40;car lst&amp;#41; &amp;#40;isort lst&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;in-isort-lemma&amp;#125;
&lt;br /&gt;
&amp;nbsp; T
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
Again we have an inductive lemma we need to prove to wrap this up: (in x (insert x y))
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
Induction on insert gives us these obligations&amp;#58;
&lt;br /&gt;
1. &amp;#40;implies &amp;#40;atom y&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;in x &amp;#40;insert x y&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
2. &amp;#40;implies &amp;#40;and &amp;#40;not &amp;#40;atom y&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;&amp;lt;= x &amp;#40;car y&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;in x &amp;#40;insert x y&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
3. &amp;#40;implies &amp;#40;and &amp;#40;not &amp;#40;atom y&amp;#41;&amp;#41; 
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;not &amp;#40;&amp;lt;= x &amp;#40;car y&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;in x &amp;#40;insert x &amp;#40;cdr y&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
1. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;atom y&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;#40;in x &amp;#40;insert x y&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of insert, H1&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;in x &amp;#40;cons x nil&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of in, reflexivity of equal&amp;#125;
&lt;br /&gt;
&amp;nbsp; T
&lt;br /&gt;

&lt;br /&gt;
2. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;not &amp;#40;atom y&amp;#41;&amp;#41;
&lt;br /&gt;
H2&amp;#41; &amp;#40;&amp;lt;= x &amp;#40;car y&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;#40;in x &amp;#40;insert x y&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of insert, H1, H2&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;in x &amp;#40;cons x y&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of in, reflexivity of equal&amp;#125;
&lt;br /&gt;
&amp;nbsp; T
&lt;br /&gt;

&lt;br /&gt;
3. Hypotheses&amp;#58;
&lt;br /&gt;
H1&amp;#41; &amp;#40;not &amp;#40;atom y&amp;#41;&amp;#41;
&lt;br /&gt;
H2&amp;#41; &amp;#40;not &amp;#40;&amp;lt;= x &amp;#40;car y&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
H3&amp;#41; &amp;#40;in x &amp;#40;insert x &amp;#40;cdr y&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;#40;in x &amp;#40;insert x y&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of insert, H1, H2&amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;#40;in x &amp;#40;cons &amp;#40;car y&amp;#41; &amp;#40;insert x &amp;#40;cdr y&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
= &amp;#123;definition of in, H3, propositional logic&amp;#125;
&lt;br /&gt;
&amp;nbsp; T
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
And thus insertion sort indeed sorts. Some of those lemmas I came up with aren't necessary to prove in mechanical systems because they're easy enough to get. Nifty stuff.
&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;text-decoration: underline&quot;&gt;I Don't Like Math - Is Functional Programming Still For Me?&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
Awww, you don't like math? They beat it out of you as a kid I'm sure. Math is great.
&lt;br /&gt;
Not convinced? Well let me demonstrate the beauty of higher-order functions and macros not as mathematical wonders, but as tools to arbitrarily shorten the length of your programs - making them easier to write, read and understand.
&lt;br /&gt;
Before I begin, I will say that Google is able to do much of their cloud computing because of the paradigm of higher order functions. Perhaps you've heard of &quot;MapReduce?&quot; Both map and reduce are pervasively used higher order functions. Here is what they do.
&lt;br /&gt;

&lt;br /&gt;
Map is a function that takes a function f, and a list X. It returns the list with f applied to each element of X, in the same order (thus f must be unary). That's it, but it's very powerful.
&lt;br /&gt;
Reduce accumulates results of a map using an accumulator function of your choice. Here are their definitions
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;defun map &amp;#40;f X&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if &amp;#40;consp X&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;cons &amp;#40;f &amp;#40;car X&amp;#41;&amp;#41; &amp;#40;map f &amp;#40;cdr X&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; nil&amp;#41;&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;#40;defun reduce &amp;#40;f acc base X&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if &amp;#40;consp X&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;acc &amp;#40;f &amp;#40;car X&amp;#41;&amp;#41; &amp;#40;reduce f acc base &amp;#40;cdr X&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;base&amp;#41;&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
There are so many things I can do with these guys. Let's redefine in from the permutation example:
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;defun in &amp;#40;e X&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;reduce &amp;#40;lambda &amp;#40;x&amp;#41; &amp;#40;equal e x&amp;#41;&amp;#41; or nil X&amp;#41;&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
Lambda here is a way to create nameless functions - you don't have to use defun if you don't want to*.
&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;Macros in Scheme, a LISP-like language&lt;/span&gt;
&lt;br /&gt;
Macros are actually a hot area in programming language research. &quot;Hygienic&quot; macros are far more complicated than LISP or C macros, which are really just textual replace algorithms. Entirely unsafe stuff.
&lt;br /&gt;
Consider a C macro for swap:
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
#define swap &amp;#40;x, y&amp;#41; &amp;#123;int temp = *x; *x = *y; *y = temp; &amp;#125;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
So what happens if I do this?
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
int updateTemperature&amp;#40;int *temp&amp;#41; &amp;#123;
&lt;br /&gt;
&amp;nbsp; swap&amp;#40;temp, g_oldtemp&amp;#41;;
&lt;br /&gt;
&amp;#125;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
This expands out to
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
int updateTemperature&amp;#40;int *temp&amp;#41; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;#123;int temp = *temp; *temp = *g_oldtemp; *g_oldtemp = *temp; &amp;#125;
&lt;br /&gt;
&amp;#125;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
Luckily here the compiler would complain, trying to dereference an int, but normally you wouldn't be so lucky.
&lt;br /&gt;
Hygienic macros preserve lexical scope from where you defined your macro. I won't go into the specifics of how it does this, but it's really nifty.
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;let &amp;#40;&amp;#40;x &amp;quot;outside&amp;quot;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;let-syntax &amp;#40;&amp;#40;m &amp;#40;syntax-rules &amp;#40;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;&amp;#40;_&amp;#41; x&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;let &amp;#40;&amp;#40;x &amp;quot;inside&amp;quot;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;m&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
This expands into
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;let &amp;#40;&amp;#40;x1 &amp;quot;outside&amp;quot;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;let &amp;#40;&amp;#40;x2 &amp;quot;inside&amp;quot;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; x1&amp;#41;&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
Which is great - we wanted m to refer to the x that was in scope when we defined it. This syntax-rules thing is a transformer function that allows you to enter high-level pattern specifications for your macros - no mucking about with consing symbols everywhere (see the list macro below).
&lt;br /&gt;
Consider a language with lambda but no let. I can define let this way
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;let-syntax &amp;#40;&amp;#40;let &amp;#40;syntax-rules &amp;#40;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;&amp;#40;_ &amp;#40;&amp;#40;id expr&amp;#41; ...&amp;#41; b ...&amp;#41;&amp;nbsp; &amp;#40;lambda &amp;#40;id ...&amp;#41; &amp;#40;begin b ...&amp;#41;&amp;#41; expr ...&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; ...rest-of-program...&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
Neat stuff. Now, if you want to do arbitrary syntax generation without being bound to this pattern language, you can! And there's a hygiene story for that as well. You don't even have to give up the nice abstraction tools that syntax-rules gives you.
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;let-syntax &amp;#40;&amp;#40;primer &amp;#40;lambda &amp;#40;stx&amp;#41; &amp;#40;syntax-case stx &amp;#40;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;&amp;#40;_ number ...&amp;#41; &amp;#40;if &amp;#40;reduce &amp;#40;lambda &amp;#40;x&amp;#41; &amp;#40;prime? x&amp;#41;&amp;#41; and #t number&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;syntax number ...&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;raise-syntax-error &amp;quot;Failure! Only primes damn it!&amp;quot;&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; ...&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
You may have caught on that hygiene restricts you from referencing variables not in scope. Well, you can get around that. Hygienically.
&lt;br /&gt;
First, let's implement a simple version of cond, which is basically a chain of ifs compacted into a nice form.
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;letrec-syntax &amp;#40;&amp;#40;cond &amp;#40;syntax-rules &amp;#40;else&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;&amp;#40;_ &amp;#40;test result ...&amp;#41; . clauses&amp;#41; &amp;#40;if test &amp;#40;begin result ...&amp;#41; &amp;#40;cond clauses&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;&amp;#40;_ &amp;#40;else result ...&amp;#41;&amp;#41; &amp;#40;begin result ...&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; ...&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
The else in the parentheses means that else should not be considered a pattern variable, but a literal to match against. If you rebind else in your code, then it won't match with the cond else and you'll get a syntax error.
&lt;br /&gt;
Say you want to have an if where the result of the test is available to you as the variable &quot;it.&quot; It has a value, and it will be in your result code, so you can't just say it's a literal to match against. Here's what you do.
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;let-syntax &amp;#40;&amp;#40;ifit &amp;#40;lambda &amp;#40;stx&amp;#41; &amp;#40;syntax-case stx &amp;#40;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;&amp;#40;_ test then else&amp;#41; &amp;#40;with-syntax &amp;#40;&amp;#40;it &amp;#40;datum-&amp;gt;syntax &amp;#40;syntax then&amp;#41; 'it&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;syntax &amp;#40;let &amp;#40;&amp;#40;it test&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;if it then else&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
; test code&amp;#58;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if 3 it #f&amp;#41;&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
Pretty sweet huh? datum-&amp;gt;syntax can introduce identifiers into whichever lexical scope you want by giving it the corresponding syntax object.
&lt;br /&gt;
By building up these syntactic abstractions, you can eliminate boilerplate code in your programs (say a complicated initialization sequence) and solve problems in the notation you want to solve them in. These macros can be arbitrarily complex, and our understanding of how to prove properties about them is extremely limited (normally you completely macro-expand before you start proving theorems in these mechanized theorem provers).
&lt;br /&gt;
My research is focusing on how to allow reasoning about macros so you can prove semantics-preserving program transformations correct, instead of having to prove in each instance of their use that the resulting code is semantically equivalent to the macro's input.
&lt;br /&gt;

&lt;br /&gt;
I know this post is long, and I kinda skimped on details close to the end, but I hope this conversation will continue so I may expand on what great possibilities there are in functional programming languages.
&lt;br /&gt;

&lt;br /&gt;
&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;text-decoration: underline&quot;&gt;List Processing Axioms&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;car &amp;#40;cons x y&amp;#41;&amp;#41; = x
&lt;br /&gt;
&amp;#40;cdr &amp;#40;cons x y&amp;#41;&amp;#41; = y
&lt;br /&gt;
&amp;#40;consp &amp;#40;cons x y&amp;#41;&amp;#41; = T
&lt;br /&gt;
&amp;#40;atom x&amp;#41;&amp;nbsp; = &amp;#40;not &amp;#40;consp x&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;implies &amp;#40;consp x&amp;#41; 
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;equal &amp;#40;cons &amp;#40;car x&amp;#41; &amp;#40;cdr x&amp;#41;&amp;#41; x&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;#40;null NIL&amp;#41; = T
&lt;br /&gt;
&amp;#40;null x&amp;#41; = NIL &amp;#40;if x &amp;lt;&amp;gt; NIL&amp;#41;
&lt;br /&gt;
&amp;#40;if NIL x y&amp;#41; = y
&lt;br /&gt;
&amp;#40;if w x y&amp;#41; = x &amp;#40;if w &amp;lt;&amp;gt; NIL&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;#40;append x y&amp;#41; = 
&lt;br /&gt;
&amp;#40;if &amp;#40;consp x&amp;#41; 
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;cons &amp;#40;car x&amp;#41; &amp;#40;append &amp;#40;cdr x&amp;#41; y&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; y&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
&amp;#40;reverse x&amp;#41; =
&lt;br /&gt;
&amp;#40;if &amp;#40;consp x&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#40;append &amp;#40;reverse &amp;#40;cdr x&amp;#41;&amp;#41; &amp;#40;list &amp;#40;car x&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; nil&amp;#41;
&lt;br /&gt;

&lt;br /&gt;
defun means &amp;quot;define function.&amp;quot;
&lt;br /&gt;

&lt;br /&gt;
&amp;#40;list x&amp;#41; = &amp;#40;cons x nil&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
Actually, list is a macro, which means it takes arbitrary syntax and expands into core syntax. Here is the full definition of list.
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;#40;defmacro &amp;#40;list &amp;amp;rest args&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;#40;if &amp;#40;consp args&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#40;cons 'cons 
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;cons 
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;car args&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#40;cons &amp;#40;cons 'list &amp;#40;cdr args&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;nil&amp;#41;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;nil&amp;#41;&amp;#41;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
This is a recursive macro definition. In LISP, this is generally discouraged since macro expansion tends to be slow. A better implementation would call a function that would generate the complete list syntax for the macro to &quot;reify&quot; (turn from a list of symbols into accepted syntax). This close connection between programs and data is what makes LISP-like languages so powerful.
&lt;br /&gt;

&lt;br /&gt;
In LISP, NIL stands for false and the empty list. This paradigm has since been rejected with newer LISP-like languages.
&lt;br /&gt;

&lt;br /&gt;
* In this example I glossed over the fact that or is a macro that can take any number of arguments. Macros cannot be passed around like functions in most languages, so think of this or as (lambda (x y) (or x y)).
&lt;br /&gt;_________________&lt;br /&gt;The one true Ninkazu.&lt;/span&gt;&lt;br /&gt;
</description>
</item>
</channel>
</rss>

