<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-946988155791957710</id><updated>2011-11-20T00:43:02.434-06:00</updated><category term='C#'/><category term='OOP'/><category term='Project Euler'/><category term='misc.'/><category term='object-oriented'/><category term='F#'/><category term='javascript'/><category term='Arrows'/><category term='Functional Programming'/><category term='software design princilples'/><category term='opinion'/><title type='text'>Diary of a Professional Amateur</title><subtitle type='html'>Random musings about my experiences and interest in the world of computer programming.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thedwalker.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://thedwalker.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Thedric Walker</name><uri>http://www.blogger.com/profile/17473224736712119577</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_--mfwqYkB5Y/SMsRBHLNcMI/AAAAAAAAAAM/Ev8y93KKEzU/S220/018.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-946988155791957710.post-4503372369732125982</id><published>2010-03-29T19:43:00.000-05:00</published><updated>2010-03-29T19:43:00.599-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc.'/><title type='text'>When we last left our hero…</title><content type='html'>&lt;p&gt;He had finished writing an implementation of Hughes’ arrows in F# and&amp;#160; was dangling precariously over the concept of object-oriented design patterns in JavaScript. &lt;/p&gt;  &lt;p&gt;I shall return to that eventually. (I think.) But, I have two major things that are going on in my coding life. One is translating an ASP.Net WebForms based website to ASP.Net MVC 2. The other is writing an IOC adapter for integrating Ninject into the FubuMVC framework. &lt;/p&gt;  &lt;p&gt;Well, I’ll be talking about these things in the coming weeks. Plus, I’ll get back to that Javascript thing.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/946988155791957710-4503372369732125982?l=thedwalker.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thedwalker.blogspot.com/feeds/4503372369732125982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=946988155791957710&amp;postID=4503372369732125982' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/4503372369732125982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/4503372369732125982'/><link rel='alternate' type='text/html' href='http://thedwalker.blogspot.com/2010/03/when-we-last-left-our-hero.html' title='When we last left our hero…'/><author><name>Thedric Walker</name><uri>http://www.blogger.com/profile/17473224736712119577</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_--mfwqYkB5Y/SMsRBHLNcMI/AAAAAAAAAAM/Ev8y93KKEzU/S220/018.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-946988155791957710.post-6603493678320737329</id><published>2009-06-17T07:01:00.004-05:00</published><updated>2009-06-17T08:52:47.499-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='object-oriented'/><category scheme='http://www.blogger.com/atom/ns#' term='OOP'/><title type='text'>Design Patterns in Javascript: Part 1 Template Method</title><content type='html'>&lt;p&gt;The Template Method pattern is good for time when you have an algorithm that is pretty stable except at a specific point. So if you have a task defined as :&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;var&lt;/span&gt; worker = {&lt;br&gt;    doTask : &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() {&lt;br&gt;        &lt;span style="color: #0000ff"&gt;while&lt;/span&gt;(!done){&lt;br&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.doStep1();&lt;br&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.doStep2();&lt;br&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.doStep3();&lt;br&gt;        }&lt;br&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; done;&lt;br&gt;    },&lt;br&gt;    done : &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;&lt;br&gt;};&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;So here we have our basic worker. All our workers repeatedly do 3 steps until done to complete task. Let’s define three different types of workers.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;First let’s we will need to take care of a deficiency with Javascript prototypal inheritance model: &lt;/p&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt; (Object.create) !== &lt;span style="color: #006080"&gt;'function'&lt;/span&gt;){&lt;br&gt;    Object.create = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (oldObject) {&lt;br&gt;        &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; F() {}&lt;br&gt;        F.prototype = oldObject;&lt;br&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; F();&lt;br&gt;    };&lt;br&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;OK, on to the worker objects: &lt;/p&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;var&lt;/span&gt; oneTimer = Object.create(worker);&lt;br&gt;oneTimer.doStep1 = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() {&lt;br&gt;    &lt;span style="color: #008000"&gt;// Step 1...&lt;/span&gt;&lt;br&gt;};&lt;br&gt;oneTimer.doStep2 = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() {&lt;br&gt;    &lt;span style="color: #008000"&gt;// Step 2...&lt;/span&gt;&lt;br&gt;}&lt;br&gt;oneTimer.doStep3 = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() {&lt;br&gt;    &lt;span style="color: #008000"&gt;// Step 3...&lt;/span&gt;&lt;br&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.done = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;br&gt;}&lt;br&gt; &lt;br&gt;&lt;span style="color: #0000ff"&gt;var&lt;/span&gt; twoTimer = Object.create(oneTimer);&lt;br&gt;twoTimer.times = 2;&lt;br&gt;twoTimer.doStep3 = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() {&lt;br&gt;    &lt;span style="color: #008000"&gt;// Step 3...&lt;/span&gt;&lt;br&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.times--;&lt;br&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.done = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.times === 0;&lt;br&gt;};&lt;br&gt; &lt;br&gt;&lt;span style="color: #0000ff"&gt;var&lt;/span&gt; tireless = Object.create(oneTimer);&lt;br&gt;tireless.doStep3 = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() {&lt;br&gt;    &lt;span style="color: #008000"&gt;// Infinite worker&lt;/span&gt;&lt;br&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.done = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;br&gt;};&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;Now I can call the doTask of the worker object that I need. So if I, by some strange occurrence, need a tireless worker I’d do this: &lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;tireless.doTask();&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Not much to implement this pattern, is there? This is just like a C# or Java implementation where worker would be and abstract class. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/946988155791957710-6603493678320737329?l=thedwalker.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thedwalker.blogspot.com/feeds/6603493678320737329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=946988155791957710&amp;postID=6603493678320737329' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/6603493678320737329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/6603493678320737329'/><link rel='alternate' type='text/html' href='http://thedwalker.blogspot.com/2009/06/design-patterns-in-javascript-part-1.html' title='Design Patterns in Javascript: Part 1 Template Method'/><author><name>Thedric Walker</name><uri>http://www.blogger.com/profile/17473224736712119577</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_--mfwqYkB5Y/SMsRBHLNcMI/AAAAAAAAAAM/Ev8y93KKEzU/S220/018.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-946988155791957710.post-7027364306799012381</id><published>2009-06-16T14:56:00.004-05:00</published><updated>2009-06-16T19:25:00.025-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='object-oriented'/><category scheme='http://www.blogger.com/atom/ns#' term='OOP'/><title type='text'>Design Patterns in Javascript: Introduction</title><content type='html'>I have a bit of extra time on my hands right now so I decided to do a series on design patterns in Javascipt. I know some of you have probably heard rumors that Javascript is an object oriented language, right? Well, that is true.&lt;br /&gt;Now some folks used to tell you that Javascript is not object-oriented. They'll probably say something like it's object-based. They'll reason that Javascript doesn't have true inheritance, encapsulation, or polymorphism. What these people really were (and some may still be) saying is that JS does not have class-based object oriented programming, natively. But, classes are not the only way to implement OOP. JS, Lua, and Perl implement OOP using prototypes.&lt;br /&gt;&lt;br /&gt;Now since JS &lt;span style="font-weight: bold;"&gt;is&lt;/span&gt; an object-oriented language, we should find at least some of the GOF design patterns useful.&lt;br /&gt;&lt;br /&gt;In the next post we will look at the Template Method pattern.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/946988155791957710-7027364306799012381?l=thedwalker.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thedwalker.blogspot.com/feeds/7027364306799012381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=946988155791957710&amp;postID=7027364306799012381' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/7027364306799012381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/7027364306799012381'/><link rel='alternate' type='text/html' href='http://thedwalker.blogspot.com/2009/06/design-patterns-in-javascript.html' title='Design Patterns in Javascript: Introduction'/><author><name>Thedric Walker</name><uri>http://www.blogger.com/profile/17473224736712119577</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_--mfwqYkB5Y/SMsRBHLNcMI/AAAAAAAAAAM/Ev8y93KKEzU/S220/018.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-946988155791957710.post-7845181147395305969</id><published>2009-03-01T09:43:00.002-06:00</published><updated>2009-03-01T10:51:31.306-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='opinion'/><category scheme='http://www.blogger.com/atom/ns#' term='software design princilples'/><title type='text'>A strange fight, indeed.</title><content type='html'>It was strange to see the cowboy coders and the artisan coders go at it. For those that don't know SO #38 sparked a discussion that has been brewing for some time now. You know you've seen it around the office. That guy who doesn't get why you'd waste your time on using factory pattern instead of a giant switch block to choose which derived classes you should use. Or the chick who is always waxing poetic about the virtues of the current standards. Well these two side have had at it.&lt;br /&gt;&lt;br /&gt;The funny thing is that this whole argument about principles in software design/engineering/development/architecture/whatever you want to call it is because of one word, &lt;span style="font-weight: bold;"&gt;PRINCIPLE&lt;/span&gt;. What is a principle? A principle is &lt;span class="sense_break"&gt;&lt;span class="sense_content"&gt;&lt;strong&gt;&lt;/strong&gt; a comprehensive and fundamental law, doctrine, or assumption. OK, so a principle is a law of some sort. And that is where a lot of people stop in the definition. But what about the other words in that list of possibilities. A doctrine is something that is taught or a set of strategies. An assumption is &lt;/span&gt;&lt;/span&gt;&lt;span class="sense_break"&gt;&lt;span class="sense_break"&gt;&lt;span class="sense_break"&gt;&lt;span class="sense_break"&gt;&lt;span class="sense_break"&gt;&lt;span class="sense_content"&gt;&lt;strong&gt;&lt;/strong&gt; a fact or statement (as a proposition, axiom, postulate, or notion) taken for granted. Those other to choices don't seem as finite as a law. &lt;br /&gt;&lt;br /&gt;OK that all fine, well, and good, but why was it such a big deal about five documents that are about 13 years old. Well, other than the misspoken and rescinded statement of one particular developers credentials, a lot of developer seem to resent being told that their programming doctrine is wrong. (Oops, there is that word again) But what they fell to realize is they them selves are the ones that assumed that it was being criticized. No where does it say you must follow these "principles". Even the author of the referenced papers does not say that you have to. He believes that if you are able to craft good, clean code by some other standards then by all means do so.&lt;br /&gt;&lt;br /&gt;Well, one last thing. The word principle probably shouldn't have been used in naming these tenants. It was the authors artistic license to do so. It would seem he wanted to emphasize the importance of them. However, they are not principle in the commonly known sense of being a law. Rather, they are principles in that they are doctrine for a certain style of programming.  If you don't subscribe to that style of programming then don't worry about them.&lt;br /&gt;&lt;br /&gt;Robert C. Martin, the aforementioned author, has likened our craft to martial arts. You have different dojos, with different ways and motivations for doing what they do. Even in the same style, there are subtle differences. There are also differences in the way individual practitioners of approach the style.  The true martial artist doesn't criticize other styles they except it as different. So I think that programmers, software developers, code monkeys, whomever put finger to key for the purpose of solving problems through logic should be able to accept the differences in coding style.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/946988155791957710-7845181147395305969?l=thedwalker.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thedwalker.blogspot.com/feeds/7845181147395305969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=946988155791957710&amp;postID=7845181147395305969' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/7845181147395305969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/7845181147395305969'/><link rel='alternate' type='text/html' href='http://thedwalker.blogspot.com/2009/03/strange-fight-indeed.html' title='A strange fight, indeed.'/><author><name>Thedric Walker</name><uri>http://www.blogger.com/profile/17473224736712119577</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_--mfwqYkB5Y/SMsRBHLNcMI/AAAAAAAAAAM/Ev8y93KKEzU/S220/018.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-946988155791957710.post-1654100103428657980</id><published>2008-09-28T00:15:00.005-05:00</published><updated>2008-10-01T16:10:45.802-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Functional Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Arrows'/><category scheme='http://www.blogger.com/atom/ns#' term='F#'/><title type='text'>A stab at Arrow, Part 3</title><content type='html'>Well I had an interesting breakthrough today. I got the |||, left, right, and +++ operators, uhmm, operational. The code is as follows&lt;br /&gt;&lt;br /&gt;&lt;pre   style="color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);font-family:'Verdana';font-size:10pt;"&gt;#light&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;type&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'inp&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'out&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt; (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'inp&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;;&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'out&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;) =&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; func &lt;span style="color: rgb(255, 255, 255);"&gt;=&lt;/span&gt; f&lt;br /&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;member&lt;/span&gt; a&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run x &lt;span style="color: rgb(255, 255, 255);"&gt;=&lt;/span&gt; func x&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; arr f &lt;span style="color: rgb(255, 255, 255);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;new&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;&lt;span style="color: rgb(0, 255, 0);"&gt;'i&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'o&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;(&gt;.&gt;) (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'inp&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'mid&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) (&lt;/span&gt;g&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'mid&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'out&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt; arr &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run &lt;span style="color: rgb(255, 255, 255);"&gt;&gt;&gt;&lt;/span&gt; g&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;(&amp;amp;.&amp;amp;) (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'c&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;)  (&lt;/span&gt;g&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'d&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&amp;amp;&gt;) =&lt;/span&gt; arr &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;fun&lt;/span&gt; i &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt; (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run i&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; g&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run i&lt;span style="color: rgb(255, 255, 255);"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; first &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt; arr &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;fun&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;i&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;x&lt;span style="color: rgb(255, 255, 255);"&gt;) -&gt; (&lt;/span&gt; f&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run i&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; x&lt;span style="color: rgb(255, 255, 255);"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; second &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; swap &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;x&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;y&lt;span style="color: rgb(255, 255, 255);"&gt;) = (&lt;/span&gt;y&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;x&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;arr swap&lt;span style="color: rgb(255, 255, 255);"&gt;) &gt;.&gt; (&lt;/span&gt;first f&lt;span style="color: rgb(255, 255, 255);"&gt;) &gt;.&gt; (&lt;/span&gt;arr swap&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;( *.* ) (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) (&lt;/span&gt;g&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'c&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'d&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) = (&lt;/span&gt;first f&lt;span style="color: rgb(255, 255, 255);"&gt;) &gt;.&gt; (&lt;/span&gt;second g&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;type&lt;/span&gt; either&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt; =&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;|&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Left&lt;/span&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;of&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;|&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Right&lt;/span&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;of&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;( |.| ) (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'c&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) (&lt;/span&gt;g&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'c&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt;&lt;br /&gt; arr &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;fun&lt;/span&gt; x &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;match&lt;/span&gt; x &lt;span style="color: rgb(178, 104, 24);"&gt;with&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color: rgb(255, 255, 255);"&gt;|&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Left&lt;/span&gt; a &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; f&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run a&lt;br /&gt;                 &lt;span style="color: rgb(255, 255, 255);"&gt;|&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Right&lt;/span&gt; b &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; g&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run b&lt;br /&gt;     &lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; left &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&amp;amp;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt;&lt;br /&gt; arr &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;&lt;br /&gt;     &lt;span style="color: rgb(178, 104, 24);"&gt;fun&lt;/span&gt; x &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;match&lt;/span&gt; x &lt;span style="color: rgb(178, 104, 24);"&gt;with&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color: rgb(255, 255, 255);"&gt;|&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Left&lt;/span&gt; a &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Left&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run a&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;                 &lt;span style="color: rgb(255, 255, 255);"&gt;|&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Right&lt;/span&gt; a &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Right&lt;/span&gt; a&lt;br /&gt;     &lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;&lt;br /&gt;let&lt;/span&gt; right &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; mirror &lt;span style="color: rgb(255, 255, 255);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;fun&lt;/span&gt; x &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;match&lt;/span&gt; x &lt;span style="color: rgb(178, 104, 24);"&gt;with&lt;/span&gt;&lt;br /&gt;                         &lt;span style="color: rgb(255, 255, 255);"&gt;|&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Left&lt;/span&gt; a &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Right&lt;/span&gt; a&lt;br /&gt;                         &lt;span style="color: rgb(255, 255, 255);"&gt;|&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Right&lt;/span&gt; a &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Left&lt;/span&gt; a&lt;br /&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;arr mirror&lt;span style="color: rgb(255, 255, 255);"&gt;) &gt;.&gt;&lt;/span&gt; left f &gt;&lt;span style="color: rgb(255, 255, 255);"&gt;.&gt; (&lt;/span&gt;arr mirror&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;( +.+ ) (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) (&lt;/span&gt;g&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'c&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'d&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) = (&lt;/span&gt;left f&lt;span style="color: rgb(255, 255, 255);"&gt;) &gt;.&gt; (&lt;/span&gt;right g&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I have kind of gotten the loop combinator working, But it is a loop combinator combined with a delay function.&lt;br /&gt;&lt;br /&gt;Well I guess next, it about time to explain some of this mess.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/946988155791957710-1654100103428657980?l=thedwalker.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thedwalker.blogspot.com/feeds/1654100103428657980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=946988155791957710&amp;postID=1654100103428657980' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/1654100103428657980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/1654100103428657980'/><link rel='alternate' type='text/html' href='http://thedwalker.blogspot.com/2008/09/stab-at-arrow-part-3.html' title='A stab at Arrow, Part 3'/><author><name>Thedric Walker</name><uri>http://www.blogger.com/profile/17473224736712119577</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_--mfwqYkB5Y/SMsRBHLNcMI/AAAAAAAAAAM/Ev8y93KKEzU/S220/018.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-946988155791957710.post-3140561454265453730</id><published>2008-09-22T00:11:00.002-05:00</published><updated>2008-09-22T00:45:41.558-05:00</updated><title type='text'>A bit of a snag</title><content type='html'>&lt;span style="font-family: verdana;"&gt;Well it seem that I have hit a bit of a snag in implementing the arrow combinators. I can't for the life of me figure out  how to write the &lt;/span&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;loop&lt;/span&gt;&lt;span style="font-family: verdana;"&gt; or the ( ||| ) combinator. The later is problem with my understanding of how to use the Choice type and discriminating unions. But with the former I am genuinely lost.  Here is the Haskell signature for &lt;span style="font-weight: bold;"&gt;loop&lt;/span&gt;&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;Class Arrow arr =&gt; ArrowLoop arr where&lt;br /&gt;  loop :: arr (a,c) (b,c)  -&gt; arr a b&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;So in F# that should be either:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;val loop : Arrow&lt;('a*'c),('b*'c)&gt; -&gt; Arrow&lt;'a,'b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;or :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;val loop: ArrowLoop&lt;('a*'c),('b*'c)&gt; -&gt; Arrow&lt;'a,'b&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Again in Haskell the&lt;span style="font-weight: bold;"&gt; loop &lt;/span&gt;combinator for functions is defined as:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;instance ArrowLoop  (-&gt;) where&lt;br /&gt;  loop f a = b&lt;br /&gt;    where (b,c) = f (a,c)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Now how would you implement that in F#?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/946988155791957710-3140561454265453730?l=thedwalker.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thedwalker.blogspot.com/feeds/3140561454265453730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=946988155791957710&amp;postID=3140561454265453730' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/3140561454265453730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/3140561454265453730'/><link rel='alternate' type='text/html' href='http://thedwalker.blogspot.com/2008/09/bit-of-snag.html' title='A bit of a snag'/><author><name>Thedric Walker</name><uri>http://www.blogger.com/profile/17473224736712119577</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_--mfwqYkB5Y/SMsRBHLNcMI/AAAAAAAAAAM/Ev8y93KKEzU/S220/018.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-946988155791957710.post-3227409901333368251</id><published>2008-09-12T20:09:00.013-05:00</published><updated>2008-09-19T09:12:30.773-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Functional Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Arrows'/><category scheme='http://www.blogger.com/atom/ns#' term='F#'/><title type='text'>A Stab at Hughes Arrows in F#</title><content type='html'>&lt;span style="font-family:verdana;"&gt;Well it's been awhile since I have posted. For one I 've been a bit bogged down with work. But that's another story that I might go into at a later date. What I wanted to blog about today is arrow. Some of you may be familiar with them. They are abstract constructs that can be very useful in things like animation or event driven programing. How did I go from Euler problems to abstract patterns?&lt;br /&gt;&lt;br /&gt;Well it started with my love of video games. Since I like a lot I have hidden aspirations of being a game programmer. (Although to this date I have work only on one game which as far as I know never saw the light of day.) So I was looking into using functional programming techniques with game programming. (BTW there is an interesting journal &lt;a href="http://www.gamedev.net/community/forums/mod/journal/journal.asp?user=potentialwell"&gt;here&lt;/a&gt; by a functional programmer.) So I started looking at animation. I came across an old paper about the Fran framework. It is based on the functional reactive (FR of Fran) programming. But that wasn't the interesting part. It is what this library spawned which is Yampa. Yampa makes extensive use of arrows. So my interest was piqued. I went to look for information on these arrows.&lt;br /&gt;&lt;br /&gt;Through the use of the "Programming with Arrows" and "Directing JavaScript with Arrows", I was able to get a little bit of a hold on the concept of arrows. So with a dangerous amount of knowledge of arrows and F# I wrote this:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.gamedev.net/community/forums/mod/journal/journal.asp?user=potentialwell"&gt;&lt;span style="text-decoration: underline; font-weight: bold;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;pre   style="color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);font-family:'Courier New';font-size:10pt;"&gt;#light&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;module&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;=&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;type&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'inp&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'out&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt; (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'inp&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'out&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;) =&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;member&lt;/span&gt; a&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run x &lt;span style="color: rgb(255, 255, 255);"&gt;=&lt;/span&gt; f x&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; arr f &lt;span style="color: rgb(255, 255, 255);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;new&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'i&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'o&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; op_RightShift &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'inp&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'mid&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) (&lt;/span&gt;g&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'mid&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'out&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt;&lt;br /&gt; arr &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;fun&lt;/span&gt; i &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt;&lt;/span&gt; g&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run&lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run i&lt;span style="color: rgb(255, 255, 255);"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;(&amp;amp;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;) (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'c&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;;)  (&lt;/span&gt;g&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'d&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt;&lt;br /&gt; arr &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;fun&lt;/span&gt; i &lt;span style="color: rgb(255, 255, 255);"&gt;-&gt; (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run i&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; g&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run i&lt;span style="color: rgb(255, 255, 255);"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; first &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt;&lt;br /&gt; arr &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;fun&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;i&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;x&lt;span style="color: rgb(255, 255, 255);"&gt;) -&gt; (&lt;/span&gt; f&lt;span style="color: rgb(255, 255, 255);"&gt;.&lt;/span&gt;run i&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; x&lt;span style="color: rgb(255, 255, 255);"&gt;))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; second &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; swap &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;x&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;y&lt;span style="color: rgb(255, 255, 255);"&gt;) = (&lt;/span&gt;y&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;x&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;arr swap&lt;span style="color: rgb(255, 255, 255);"&gt;) &gt;&gt;&gt; (&lt;/span&gt;first f&lt;span style="color: rgb(255, 255, 255);"&gt;) &gt;&gt;&gt; (&lt;/span&gt;arr swap&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(178, 104, 24);"&gt;let&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;( *** ) (&lt;/span&gt;f&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'a&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'b&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) (&lt;/span&gt;g&lt;span style="color: rgb(255, 255, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Arrow&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'c&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 255, 0);"&gt;'d&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&gt;) =&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;first f&lt;span style="color: rgb(255, 255, 255);"&gt;) &gt;&gt;&gt; (&lt;/span&gt;second g&lt;span style="color: rgb(255, 255, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I was surprised how quickly I was able to get this together. So what do you think? How can I improve it? What did I do wrong? All comments are welcome.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/946988155791957710-3227409901333368251?l=thedwalker.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thedwalker.blogspot.com/feeds/3227409901333368251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=946988155791957710&amp;postID=3227409901333368251' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/3227409901333368251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/3227409901333368251'/><link rel='alternate' type='text/html' href='http://thedwalker.blogspot.com/2008/09/well-its-been-awhile-since-i-have.html' title='A Stab at Hughes Arrows in F#'/><author><name>Thedric Walker</name><uri>http://www.blogger.com/profile/17473224736712119577</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_--mfwqYkB5Y/SMsRBHLNcMI/AAAAAAAAAAM/Ev8y93KKEzU/S220/018.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-946988155791957710.post-8739686070082701011</id><published>2008-06-03T01:07:00.001-05:00</published><updated>2008-06-06T08:15:28.260-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Functional Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler Problem 9 in C#</title><content type='html'>&lt;span style="font-family:lucida grande;"&gt;So I have just finished Problem 9. You have got to love the Pythagorean Theorem. I have always been a math geek and I was awestruck when my preCalculus teacher took the time to prove it.  Let me tell you. That was the longest bit of logic that I had seen in my 17 years of life. But there it was all 2 whiteboards full. It would have been 3 but he ran out of room.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:lucida grande;"&gt;Well, problem number 9 was an interesting return to the world of Pythagoras. If you haven't looked at the riddle, here it is:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:lucida grande;"&gt;Find the only Pythagorean triplet, {&lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;a&lt;/var&gt;&lt;span style="font-family:lucida grande;"&gt;, &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;b&lt;/var&gt;&lt;span style="font-family:lucida grande;"&gt;, &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;c&lt;/var&gt;&lt;span style="font-family:lucida grande;"&gt;}, for which &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;a&lt;/var&gt;&lt;span style="font-family:lucida grande;"&gt; + &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;b&lt;/var&gt;&lt;span style="font-family:lucida grande;"&gt; + &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;c&lt;/var&gt;&lt;span style="font-family:lucida grande;"&gt; = 1000.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:lucida grande;"&gt;OK. The first thing we know is that &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;a&lt;/var&gt;&lt;sup style="font-family: lucida grande;"&gt;2&lt;/sup&gt;&lt;span style="font-family:lucida grande;"&gt; + &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;b&lt;/var&gt;&lt;sup style="font-family: lucida grande;"&gt;2&lt;/sup&gt;&lt;span style="font-family:lucida grande;"&gt; = &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;c&lt;/var&gt;&lt;sup style="font-family: lucida grande;"&gt;2&lt;/sup&gt;&lt;span style="font-family:lucida grande;"&gt; is Pythagorean Theorem.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:lucida grande;"&gt;Now to find Pythagorean Triplets with positive whole numbers(natural numbers) we could try iterating through the infinite set of number until we found the right set or we could use this formula:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;var style="font-family: lucida grande;"&gt;a&lt;/var&gt;&lt;span style="font-family:lucida grande;"&gt; = 2&lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;mn&lt;/var&gt;&lt;br /&gt;&lt;var style="font-family: lucida grande;"&gt;b&lt;/var&gt;&lt;span style="font-family:lucida grande;"&gt; = &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;m&lt;/var&gt;&lt;sup style="font-family: lucida grande;"&gt;2&lt;/sup&gt;&lt;span style="font-family:lucida grande;"&gt; - &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;n&lt;/var&gt;&lt;sup style="font-family: lucida grande;"&gt;2&lt;/sup&gt;&lt;br /&gt;&lt;var style="font-family: lucida grande;"&gt;c&lt;/var&gt;&lt;span style="font-family:lucida grande;"&gt; = &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;m&lt;/var&gt;&lt;sup style="font-family: lucida grande;"&gt;2&lt;/sup&gt;&lt;span style="font-family:lucida grande;"&gt; + &lt;/span&gt;&lt;var style="font-family: lucida grande;"&gt;n&lt;/var&gt;&lt;sup style="font-family: lucida grande;"&gt;2&lt;/sup&gt;&lt;br /&gt;&lt;span style="font-family:lucida grande;"&gt;where m &gt; n &gt; 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:lucida grande;"&gt;So now we have:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center; font-family: lucida grande;"&gt;                         1000 = a + b + c&lt;br /&gt;                                                        1000 = (2&lt;var&gt;mn&lt;/var&gt;) + (&lt;var&gt;m&lt;/var&gt;&lt;sup&gt;2&lt;/sup&gt; - &lt;var&gt;n&lt;/var&gt;&lt;sup&gt;2&lt;/sup&gt;) + (&lt;var&gt;m&lt;/var&gt;&lt;sup&gt;2&lt;/sup&gt; + &lt;var&gt;n&lt;/var&gt;&lt;sup&gt;2&lt;/sup&gt;)&lt;br /&gt;                                 1000 = 2&lt;var&gt;mn&lt;/var&gt; + 2&lt;var&gt;m&lt;/var&gt;&lt;sup&gt;2&lt;/sup&gt; + 0&lt;br /&gt;                        500  = &lt;var&gt;mn&lt;/var&gt; + &lt;var&gt;m&lt;/var&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;br /&gt;                        500 = &lt;var&gt;m&lt;/var&gt;(&lt;var&gt;n&lt;/var&gt; + &lt;var&gt;m&lt;/var&gt;)&lt;br /&gt;            (500/&lt;var&gt;m&lt;/var&gt;) = &lt;var&gt;n&lt;/var&gt; + &lt;var&gt;m&lt;/var&gt;&lt;br /&gt;(500/&lt;var&gt;m&lt;/var&gt;) - &lt;var&gt;m&lt;/var&gt; = &lt;var&gt;n&lt;br /&gt;&lt;/var&gt;&lt;div style="text-align: left;"&gt;&lt;var&gt;&lt;/var&gt;&lt;br /&gt;You now have what you need to write a program to find your triplet. I'll give you my inplementation later.&lt;br /&gt;&lt;var&gt;&lt;/var&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/946988155791957710-8739686070082701011?l=thedwalker.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thedwalker.blogspot.com/feeds/8739686070082701011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=946988155791957710&amp;postID=8739686070082701011' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/8739686070082701011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/8739686070082701011'/><link rel='alternate' type='text/html' href='http://thedwalker.blogspot.com/2008/06/project-euler-problem-9-in-c.html' title='Project Euler Problem 9 in C#'/><author><name>Thedric Walker</name><uri>http://www.blogger.com/profile/17473224736712119577</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_--mfwqYkB5Y/SMsRBHLNcMI/AAAAAAAAAAM/Ev8y93KKEzU/S220/018.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-946988155791957710.post-5871350826201145853</id><published>2008-06-02T20:22:00.000-05:00</published><updated>2008-06-06T08:11:37.468-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler</title><content type='html'>I know that some of you have heard about &lt;a href="http://www.projecteuler.net"&gt;Project Euler.  &lt;/a&gt;If not you should check it out. It'll give you the ol' grey matter a good stretch. The few problems that I have solved have helped to think in more of a functional manner.  I'll post some more on the solutions that I have used to solve them  later.&lt;br /&gt;&lt;br /&gt;Oh, by the way, welcome to my blog.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/946988155791957710-5871350826201145853?l=thedwalker.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thedwalker.blogspot.com/feeds/5871350826201145853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=946988155791957710&amp;postID=5871350826201145853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/5871350826201145853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/946988155791957710/posts/default/5871350826201145853'/><link rel='alternate' type='text/html' href='http://thedwalker.blogspot.com/2008/06/project-euler.html' title='Project Euler'/><author><name>Thedric Walker</name><uri>http://www.blogger.com/profile/17473224736712119577</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_--mfwqYkB5Y/SMsRBHLNcMI/AAAAAAAAAAM/Ev8y93KKEzU/S220/018.JPG'/></author><thr:total>0</thr:total></entry></feed>
