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

<channel>
	<title>Possibility and Probability &#187; Lisp</title>
	<atom:link href="http://ironboundsoftware.com/blog/category/programming/lisp/feed/" rel="self" type="application/rss+xml" />
	<link>http://ironboundsoftware.com/blog</link>
	<description>Droplets of Yes and No</description>
	<lastBuildDate>Wed, 28 Dec 2011 01:37:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Why I like the SICP book</title>
		<link>http://ironboundsoftware.com/blog/2007/11/01/why-i-like-the-sicp-book/</link>
		<comments>http://ironboundsoftware.com/blog/2007/11/01/why-i-like-the-sicp-book/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 02:00:25 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://www.ironboundsoftware.com/blog/2007/11/01/why-i-like-the-sicp-book/</guid>
		<description><![CDATA[The Structure and Interpretation of Computer Programs is turning out to be a rather awesome read. What makes it so cool for me is that I&#8217;m taking a class in Numerical Analysis, and in sections 1.2 and 1.3 the examples read like something right out of the class. The really odd thing for me is [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://mitpress.mit.edu/sicp/full-text/book/book.html">Structure and Interpretation of Computer Programs</a> is turning out to be a rather awesome read. What makes it so cool for me is that I&#8217;m taking a class in Numerical Analysis, and in sections 1.2 and 1.3 the examples read like something right out of the class. The really odd thing for me is that this &#8220;double teaming&#8221; of my brain is paying off in that I&#8217;m learning the Lispy things, and at the same time I&#8217;m learning the Numerical things. Each one builds on the other, reenforcing the lessons learned. Very recursive, just like Lisp.</p>
<p>One of the things I have learned just today is that loops are actually allowed in Lisp. All of the recursive thinking I&#8217;ve been doing lately has made me think that there&#8217;s always a way too write a loop in a recursive manner. But, I was looking at <a href="http://en.wikipedia.org/wiki/Neville%27s_algorithm">Neville&#8217;s Method</a> the other day and it struck me that with it&#8217;s nested loops, that could be quite a challenge to write it in a recursive manner. While trying to find an example of nested loop in Lisp, I found all kinds of cool links I thought I would share:</p>
<ul>
<li><a href="http://www.notam02.no/internt/cm-sys/cm-1.4/doc/contrib/lispstyle.html">Lisp style tips for the beginner</a></li>
<li><a href="http://www.psg.com/~dlamkins/sl/chapter05.html">Successful Lisp</a></li>
<li><a href="http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/math/clmath/0.html">CLMath</a></li>
</ul>
<p>Go check them out, they are great resources!</p>
]]></content:encoded>
			<wfw:commentRss>http://ironboundsoftware.com/blog/2007/11/01/why-i-like-the-sicp-book/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Lisp</title>
		<link>http://ironboundsoftware.com/blog/2007/09/24/learning-lisp/</link>
		<comments>http://ironboundsoftware.com/blog/2007/09/24/learning-lisp/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 23:20:02 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Thinking]]></category>

		<guid isPermaLink="false">http://www.ironboundsoftware.com/blog/2007/09/24/learning-lisp/</guid>
		<description><![CDATA[One of those &#8220;personal/professional&#8221; development things that you should do every so often is try to learn something new in your field. For me, I&#8217;ve decided I will learn more about Lisp, and programs in general. To that end I&#8217;ve been working my way through the book The Structure and Interpretation of Computer Programs which [...]]]></description>
			<content:encoded><![CDATA[<p>One of those &#8220;personal/professional&#8221; development things that you should do every so often is try to learn something new in your field. For me, I&#8217;ve decided I will learn more about Lisp, and programs in general.</p>
<p>To that end I&#8217;ve been working my way through the book <a href="http://mitpress.mit.edu/sicp/full-text/book/book.html">The Structure and Interpretation of Computer Programs</a> which is a dense volume that is chock full of good knowledge about how computer programs work from a critical and analytical point of view. The language the book uses is Scheme which is a variant of Lisp.</p>
<p>Having worked with <a href="http://xemacs.org">XEmacs</a> and its version of lisp (called appropriately elisp), I thought I would be able to pick up Scheme pretty quickly. This is pretty much true, since the two languages have the same general syntax/form. One thing I don&#8217;t have those is a Scheme interpreter! I did install SBCL and CLISP a while ago, so I figured that I would just use that.</p>
<p>Well, it turns out that Scheme is also slightly different than Common Lisp. <img src='http://ironboundsoftware.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  But thanks to Peter Seibel and his excellent book &#8220;Practical Common Lisp&#8221;, I was able to translate the first few programs in the SICP so that they would run in my CLISP-Slime environment.</p>
<p>So if you find yourself in this situation, be sure to check out the best <a href="http://www.gigamonkeys.com/book/">Common Lisp tutorial</a> on the net. Its free and it is very well written, so I highly recommend it. I remember playing around with it a while ago, and being impressed with it back then. The good news is it is still as good now as it was then.</p>
]]></content:encoded>
			<wfw:commentRss>http://ironboundsoftware.com/blog/2007/09/24/learning-lisp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Business Rules and the Visitor Pattern</title>
		<link>http://ironboundsoftware.com/blog/2007/05/10/business-rules-and-the-visitor-pattern/</link>
		<comments>http://ironboundsoftware.com/blog/2007/05/10/business-rules-and-the-visitor-pattern/#comments</comments>
		<pubDate>Fri, 11 May 2007 02:07:39 +0000</pubDate>
		<dc:creator>Nick Loadholtes</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.ironboundsoftware.com/blog/?p=276</guid>
		<description><![CDATA[One thing I really love about Python is that you can really knock things out quickly with it. I&#8217;ve been thinking about business rules lately, and specifically about how to make them cleaner with respect to your code. When it comes to rules, there are several places and ways you can encode them in your [...]]]></description>
			<content:encoded><![CDATA[<p>One thing I really love about <a href="http://python.org">Python</a> is that you can really knock things out quickly with it. I&#8217;ve been thinking about <a href="http://en.wikipedia.org/wiki/Business_rules">business rules</a> lately, and specifically about how to make them cleaner with respect to your code.</p>
<p>When it comes to rules, there are several places and ways you can encode them in your application, each with its own pro&#8217;s and con&#8217;s. Lately I&#8217;ve been reading a lot about Lisp based languages and every now and then I&#8217;ll read a reference to using Lisp code not only as a configuration file, but as a &#8220;executable&#8221; that carries its own data.</p>
<p>The more I thought about this, the more I wondered if this type of separation was possible in Java. Sure, I could just code the rules in Java, but where&#8217;s the fun in that? Via its reflect package, Java can do some pretty neat tricks, so I decided to try and code up some ideas in Python first since its so concise (and can also do reflection, etc.). Basically a case of &#8220;anything you can do, I can do better&#8221;.</p>
<p>A while ago I read a really interesting article about the <a href="http://en.wikipedia.org/wiki/Visitor_pattern">visitor pattern</a>. Most of the time this pattern is explained in terms of something like a driver: You have some kind of hardware that needs to call a driver to setup its connection to the system. Using the accept() and visit() methods you can make a class that can register itself with the caller and allow it to configure itself, the end result being that the caller doesn&#8217;t need to know (i.e. be linked with) the details of the visitor.</p>
<p>It occurred to me that this is the same situation with externalized business logic: The rule engine is reading in an external file and then based on the contents of that file, executing code. If a &#8220;rule&#8221; implemented the visitor pattern, and the &#8220;rule engine&#8221; implemented the accept(visitor) method, then this would allow the external file to dictate what the program would be doing without the program needing massive changes to alter the rules.</p>
<p>It boils down to this: defining the core actions separately from the rules allows a better separation betweenÂ  the two. The visitor pattern allows the two to be bound together. The end result is cleaner (smaller) code, that should be more &#8220;testable&#8221;. At least that&#8217;s my theory.</p>
<p>I&#8217;ve put the python code implementing this up on my project page (<a href="http://ironboundsoftware.googlecode.com/svn/trunk/misc/src/visitor/">here is the code</a>). Its a very simple example, there is one rule per line, and the first token (space delimited) is the function to call followed by its arguments. Internally the RuleEngine class is calling Python&#8217;s eval() function and that is what actually executes the function from the data.txt file.</p>
<p>For the function to execute successfully it needs to exist (i.e. it needs to be defined in the file, or be a built-in Python function). Note that this is not the safest approach, it will allow malicious code to execute. A more secure way to do this would be to set up a dict (or, if this is done in Java a HashMap) that contains a mapping between the rule tokens and the function to be executed. That way the execution of the RuleEngine can be controlled somewhat, in that it will only allow certain functions to be executed.</p>
]]></content:encoded>
			<wfw:commentRss>http://ironboundsoftware.com/blog/2007/05/10/business-rules-and-the-visitor-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lisp/Scheme and business logic</title>
		<link>http://ironboundsoftware.com/blog/2007/04/23/lispscheme-and-business-logic/</link>
		<comments>http://ironboundsoftware.com/blog/2007/04/23/lispscheme-and-business-logic/#comments</comments>
		<pubDate>Tue, 24 Apr 2007 00:27:14 +0000</pubDate>
		<dc:creator>Nick Loadholtes</dc:creator>
				<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.ironboundsoftware.com/blog/?p=274</guid>
		<description><![CDATA[I&#8217;ve been thinking about business logic lately. Specifically about how to make nice flexible rules without hard coding them in the code itself. This has led me to look more at Lisp-y languages like Scheme and Erlang. (I&#8217;ve got some more to say about Erlang, but that&#8217;s a topic for a later post.) At any [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been thinking about business logic lately. Specifically about how to make nice flexible rules without hard coding them in the code itself. This has led me to look more at Lisp-y languages like Scheme and <a href="http://erlang.org">Erlang</a>. (I&#8217;ve got some more to say about Erlang, but that&#8217;s a topic for a later post.)</p>
<p>At any rate, today on <a href="http://reddit.com">Reddit</a> there were a few really good postings on this topic and one of those postings led me to more really good articles on the topic. (As a side note, I&#8217;m really glad this happened today, lately reddit has been a dumping ground for picture links and other uninteresting things.)</p>
<p>While none of these links shows exact methods for implementing business rules, they are a great starting spot.</p>
<ul>
<li>
<h4 class="desc"><a rel="nofollow" href="http://steve.yegge.googlepages.com/the-emacs-problem">Stevey&#8217;s Home Page &#8211; The Emacs Problem</a></h4>
</li>
<li>
<h4 class="desc"><a rel="nofollow" href="http://fishbowl.pastiche.org/2003/05/05/dear_xml_programmers">The Fishbowl: Dear XML Programmers&#8230;</a></h4>
</li>
<li>
<h4 class="desc"><a rel="nofollow" href="http://sisc-scheme.org/">SISC &#8211; Second Interpreter of Scheme Code</a></h4>
</li>
</ul>
<p>These links also mention a lot about XML and the associated headaches that come with working with it. As one of them pointed out when you (modern programmers) think about storing data, XML usually springs to mind first. Past experiences with XML and XSLT have left a weird taste in my mouth: They seem like they are on to a good idea, but the execution and use of it just feels so contrived. These articles enlightened me to think about the data with more of a functional &#8220;lisp&#8221; frame of mind.</p>
<p>Lots of food for thought. Lately I&#8217;ve been thinking a lot about the MVC pattern and how it is trumpeted all over the place, yet sometimes it doesn&#8217;t seem to solve the core problem of getting the application out the door to the user in a timely and maintainable manner. (And when I say that, I am thinking mostly of web apps.) Perhaps this is a better way&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://ironboundsoftware.com/blog/2007/04/23/lispscheme-and-business-logic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with Python and Lisp</title>
		<link>http://ironboundsoftware.com/blog/2007/02/19/fun-with-python-and-lisp/</link>
		<comments>http://ironboundsoftware.com/blog/2007/02/19/fun-with-python-and-lisp/#comments</comments>
		<pubDate>Mon, 19 Feb 2007 15:34:33 +0000</pubDate>
		<dc:creator>Nick Loadholtes</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.ironboundsoftware.com/blog/?p=270</guid>
		<description><![CDATA[Once you fight your way through all of the junk (photo&#8217;s, xkcd comics, etc.) on reddit, you&#8217;ll occasionally find some pretty interesting and enlightening things. A few days ago I saw this link to a Scheme interpreter in Python. I&#8217;ve always been interested in the Lisp family of languages, and this is one of them [...]]]></description>
			<content:encoded><![CDATA[<p>Once you fight your way through all of the junk (photo&#8217;s, <a href="http://xkcd.com">xkcd</a> comics, etc.) on <a href="http://reddit.com">reddit</a>, you&#8217;ll occasionally find some pretty interesting and enlightening things. A few days ago I saw this link to a <a href="http://thinkpython.blogspot.com/2005/02/simple-scheme-interpreter.html">Scheme interpreter in Python</a>. I&#8217;ve always been interested in the Lisp family of languages, and this is one of them implemented in python. What a cool learning experience.</p>
<p>After looking at that for a while I tried googling for some other examples and found this really awesome <a href="http://www.ibiblio.org/obp/py4fun/lisp/lisp.html">Lisp in Python</a>  implementation.</p>
<p>Every so often I&#8217;ll think to myself &#8220;Wow, how hard can it be to make a language?&#8221; Then I&#8217;ll remember that it can be pretty damn hard (actually I remember my Programming Languages Concepts class, then I get the shakes thinking about all of the edge cases and other complications that you have to keep track of). Seeing something like these links is really educational for me, I get to see how two similar languages have been implemented (and thanks to the comments on <a href="http://programming.reddit.com/">programming.reddit.com</a>) and how they could have been done differently.</p>
]]></content:encoded>
			<wfw:commentRss>http://ironboundsoftware.com/blog/2007/02/19/fun-with-python-and-lisp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The future of programming</title>
		<link>http://ironboundsoftware.com/blog/2007/01/18/the-future-of-programming/</link>
		<comments>http://ironboundsoftware.com/blog/2007/01/18/the-future-of-programming/#comments</comments>
		<pubDate>Fri, 19 Jan 2007 03:01:04 +0000</pubDate>
		<dc:creator>Nick Loadholtes</dc:creator>
				<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.ironboundsoftware.com/blog/?p=265</guid>
		<description><![CDATA[This is an interesting time to be in the world of computers. The web is becoming more and more to everyday computing for the average user. Applications are moving off the PC and onto the web. Hardware is getting faster and faster (check this out, 80 cores on 1 chip for less that 100 watts!), [...]]]></description>
			<content:encoded><![CDATA[<p>This is an interesting time to be in the world of computers. The web is becoming more and more to everyday computing for the average user. Applications are moving off the PC and onto the web. Hardware is getting faster and faster (check this out, <a href="http://www.ddj.com/dept/64bit/196901294?cid=RSSfeed_DDJ_All">80 cores on 1 chip for less that 100 watts</a>!), and things like Operating Systems are beginning to take a back seat in the grand scheme of things.</p>
<p>With all of these changes coming around, I&#8217;m thinking that in the near future we programmers are going to have to start changing how we write our programs. We can no longer depend on gigahertz increases to drive the software faster. A point has been reached where the software needs to step up and be more efficient and utilize the new hardware more effectively.</p>
<p>Along those lines, I ran across this very cool article today: <a rel="nofollow" href="http://www.defmacro.org/ramblings/fp.html">Functional Programming For The Rest of Us</a></p>
<p>Its a really good overview of functional programming and its many advantages (concurrency, etc.). With a lot of attention being placed on &#8220;functional&#8221; features in languages like Ruby, Haskell, Python, etc. this article is a good primer on what functional programming can do for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://ironboundsoftware.com/blog/2007/01/18/the-future-of-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>remove-if-not</title>
		<link>http://ironboundsoftware.com/blog/2006/02/05/remove-if-not/</link>
		<comments>http://ironboundsoftware.com/blog/2006/02/05/remove-if-not/#comments</comments>
		<pubDate>Sun, 05 Feb 2006 07:05:04 +0000</pubDate>
		<dc:creator>Nick Loadholtes</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.ironboundsoftware.com/blog/?p=189</guid>
		<description><![CDATA[I&#8217;m trying to be a better person by wrapping my brain around the Lisp programming language. I&#8217;ve got to say, remove-if and remove-if-not are two of the most confusing function names I have ever come across. I&#8217;m sure with time and experince I&#8217;ll change my view, but as a quasi-Lisp-newbie my mind warps when I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying to be a better person by wrapping my brain around the Lisp programming language. I&#8217;ve got to say, <strong>remove-if</strong> and <strong>remove-if-not</strong> are two of the most confusing function names I have ever come across. I&#8217;m sure with time and experince I&#8217;ll change my view, but as a quasi-Lisp-newbie my mind warps when I read those function names in sample code.</p>
]]></content:encoded>
			<wfw:commentRss>http://ironboundsoftware.com/blog/2006/02/05/remove-if-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

