<?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>Squid&#039;s Blog</title>
	<atom:link href="http://gigasquidsoftware.com/wordpress/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://gigasquidsoftware.com/wordpress</link>
	<description>Random and Occasionaly Useful Thoughts About Technology</description>
	<lastBuildDate>Tue, 04 Jun 2013 18:57:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Babar &#8211; A Little Language with Speech Acts for Machines</title>
		<link>http://gigasquidsoftware.com/wordpress/?p=702</link>
		<comments>http://gigasquidsoftware.com/wordpress/?p=702#comments</comments>
		<pubDate>Tue, 04 Jun 2013 18:57:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Clojure]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[John McCarthy Papers]]></category>

		<guid isPermaLink="false">http://gigasquidsoftware.com/wordpress/?p=702</guid>
		<description><![CDATA[Preface: A Gentle Obsession About a year ago, I picked up John McCarthy&#8217;s paper on Elephant 2000. I have to admit that I only understood about 10% of it. But I was so intrigued by the ideas that it sent me on a quest. I re-read it numerous times, slept with it under my pillow, [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://gigasquidsoftware.com/wordpress/wp-content/uploads/2013/06/babarbooks2.jpeg"><img class="alignleft size-medium wp-image-704" alt="Babar Books" src="http://gigasquidsoftware.com/wordpress/wp-content/uploads/2013/06/babarbooks2-237x300.jpeg" width="237" height="300" /></a></p>
<h2>Preface: A Gentle Obsession</h2>
<p>About a year ago, I picked up John McCarthy&#8217;s paper on <a title="http://www-formal.stanford.edu/jmc/elephant/elephant.html" href="http://www-formal.stanford.edu/jmc/elephant/elephant.html">Elephant 2000</a>. I have to admit that I only understood about 10% of it. But I was so intrigued by the ideas that it sent me on a quest. I re-read it numerous times, slept with it under my pillow, and finally decided that I needed to read his other papers to get an insight into his thoughts. I began a considered effort with <a title="http://gigasquidsoftware.com/wordpress/?p=466" href="http://gigasquidsoftware.com/wordpress/?p=466">Seven McCarthy Papers in Seven Weeks</a>. It ended up taking about three months, rather than seven 7 weeks. Again I came back to Elephant 2000. I began to understand more as other ideas and concepts sunk in, like <a href="http://www-formal.stanford.edu/jmc/ascribing/ascribing.html" title="http://www-formal.stanford.edu/jmc/ascribing/ascribing.html">ascribing beliefs and goals to machines</a>. But to really explore the ideas, I really wanted to try to implement parts of Elephant in my own programming language. The problem was, having no formal training in computer science, (my background is Physics), I had never created a programming language before. The stars aligned and I found the <a title="https://github.com/Engelberg/instaparse" href="https://github.com/Engelberg/instaparse">Instaparse</a> Clojure library. The result is <a title="https://github.com/gigasquid/babar" href="https://github.com/gigasquid/babar">Babar</a>, a language designed to explore communication with machines via <a title="http://en.wikipedia.org/wiki/Speech_act" href="http://en.wikipedia.org/wiki/Speech_act">Speech Acts</a>.</p>
<h2>What are the Speech Acts?</h2>
<p>
When I say say &#8220;Pass the salt.&#8221;, the meaning behind the utterance is that I would like someone to reach out and move the salt shaker to me. I am requesting an action be performed. It doesn&#8217;t really matter if the utterance is in English, French, or Spanish. The intention is the same. Furthermore, if you accept my request to pass the salt. It creates a commitment on your part to actually perform the action. There are two types of speech acts that Babar is concerned with. The first is called an <a title="http://en.wikipedia.org/wiki/Illocutionary_act" href="http://en.wikipedia.org/wiki/Illocutionary_act">Illocutionary Act</a>. Some of the english verbs denoting these acts are &#8220;assert&#8221;, &#8220;command&#8221;, &#8220;request&#8221;, and &#8220;query&#8221;. The second is a <a title="http://en.wikipedia.org/wiki/Perlocutionary_act" href="http://en.wikipedia.org/wiki/Perlocutionary_act">Perlocutionary Act</a>. These are acts that are concerned with the effects of hearing them on future actions. Some of english verbs denoting these acts are &#8220;convince&#8221;, &#8220;persuade&#8221;, and &#8220;warn&#8221;.</p>
<h2>Hello Babar</h2>
<p>
Babar is an experimental language that uses these Speech Acts to communicate. It also combines one of the other ideas of McCarthy, that is of beliefs and goals. The ultimate aim in the language is discover ways of thinking about computers and communicating with them based on the way that we communicate with each other. The state of a computer at any given point in time can be very complex and hard to understand. If we ascribe this state to be a &#8220;belief&#8221;, it becomes easier to understand and thus easier to program. The Babar REPL has internal commitments and internal beliefs. The goal of the Babar REPL is to keep all of its commitments. Speech acts are used to &#8220;convince&#8221; Babar of beliefs and to make &#8220;requests&#8221; that form commitments. The Babar REPL continually checks to see if it needs to fulfill a commitments. It fulfills them based on its beliefs. As an optional configuration, the REPL will speak aloud its beliefs as the become true &#8211; or as it &#8220;holds&#8221; the belief.</p>
<h2>Syntax and Basics</h2>
<p>
The language uses basic Clojure datatypes and makes the parens optional in most cases to make the expressions look more like syntactically sugared speech acts.</p>
<pre>1     ;=&gt; 1
2.3   ;=&gt; 2.3
-3.4  ;=&gt; 3.4
"cat" ;=&gt; cat
:bird ;=&gt; bird
true  ;=&gt; true
{:cat :meow :dog :bark} ;=&gt; {:cat :meow :dog :bark}
[1 2 true :bird] ;=&gt; [1 2 true bird]
atom 1 ;=&gt; #

(def dog 16)
dog ;=&gt; 16
def cat 18
cat ;=&gt; 18</pre>
<p>
Vectors are a bit interesting in the respect that you don&#8217;t need to input the square brackets. If you just put in space delimited items, it will automatically construct a vector for you.</p>
<pre>1 2 3 4 ;=&gt; [1 2 3 4]</pre>
<p>
You can create anonymous functions with the fn [x] syntax from clojure. And call them with surrounding parens. You can call regular functions by the () notation or the shorthand :.</p>
<pre>fn [x] + x 1 ;=&gt; fn
(fn [x] + x 1) ;=&gt; fn
((fn [x] + x 1) 3) ;=&gt; 4
((fn [x y z] + x y z) 1 2 3) ;=&gt; 6
((fn [] [4 5 6])) ;=&gt; [4 5 6]

defn dog [] "woof"
dog: ;=&gt; "woof"</pre>
<p>
To see the complete documentation &#8211; please visit the <a href="https://github.com/gigasquid/babar" title="https://github.com/gigasquid/babar">Github repo</a>.</p>
<h2>Show Me Babar Speech Acts</h2>
<p>Now that we have the basics. Let&#8217;s look at example of running a program with speech acts.<br />
This one speaks its beliefs and has assertions, a request, and queries.</p>
<pre>speak-config true.
assert sunny false.
convince #nice-day "It is a nice day." fn [] = sunny true.
request *open-window when #nice-day fn [] println "Opened the window".
query request-is-done *open-window?
assert sunny true.
query request-is-done *open-window?</pre>
<p><iframe id="_ytid_72047" width="960" height="570" src="http://www.youtube.com/embed/bt2iYsVyCOM?enablejsapi=1&#038;origin=http://gigasquidsoftware.com&#038;autoplay=0&#038;cc_load_policy=0&#038;iv_load_policy=1&#038;loop=0&#038;modestbranding=0&#038;rel=0&#038;showinfo=1&#038;theme=dark&#038;" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe></p>
<p>
Here is another one that shows using a request until a belief is held.</p>
<pre>speak-config true.

assert counter atom 1.
convince #done "I am done counting" fn [] &gt; @counter 3.
request *count-up until #done fn [] swap! counter inc.
sleep 25.
query request-value *count-up?</pre>
<p><iframe id="_ytid_78939" width="960" height="570" src="http://www.youtube.com/embed/aT8MK0w71LM?enablejsapi=1&#038;origin=http://gigasquidsoftware.com&#038;autoplay=0&#038;cc_load_policy=0&#038;iv_load_policy=1&#038;loop=0&#038;modestbranding=0&#038;rel=0&#038;showinfo=1&#038;theme=dark&#038;" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe></p>
<p>
Here the REPL asks you a question if you give it an undeclared var</p>
<pre>speak-config true.
ask-config true.

request *task1 fn [] + 10 x.
query request-is-done *task1?
assert x 3.
sleep 10.
query request-is-done *task1?
query request-value *task1?</pre>
<p><iframe id="_ytid_71479" width="960" height="570" src="https://www.youtube.com/embed/nmi_fafmjsg?enablejsapi=1&#038;origin=http://gigasquidsoftware.com&#038;autoplay=0&#038;cc_load_policy=0&#038;iv_load_policy=1&#038;loop=0&#038;modestbranding=0&#038;rel=0&#038;showinfo=1&#038;theme=dark&#038;" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe></p>
<h2>Autonomous AR Drone Flight with Babar REPL</h2>
<p>
Since the language is aimed at communincating with machines. It is only natural that I use it to talk to the AR Drone.<br />
Here is a program that has the drone take off, get to a cruising altitude, and land &#8211; all using speech acts (and the <a href="https://github.com/gigasquid/clj-drone" title="https://github.com/gigasquid/clj-drone">clj-drone library</a>).</p>
<pre>speak-config true.

import "clj-drone.core".
import "clj-drone.navdata".

assert get-navdata [key] get @nav-data key.
assert navdata-equal [key val] = (get-navdata key) val.
assert navdata-gt [key val] &gt; (get-navdata key) val.
assert init-drone [] (drone-initialize).
assert init-nav [] (drone-init-navdata).

convince #landed "I am on the ground" fn [] (navdata-equal :control-state :landed).
convince #flying "I am flying" fn [] or (navdata-equal :control-state :flying)
                                        (navdata-equal :control-state :hovering).
convince #high-enough "I am high enough" fn [] (navdata-gt :altitude 1.5).

request *take-off when #landed fn [] (drone :take-off).
request *cruising-alt when #flying until #high-enough fn [] (drone :up 0.1).
request *land when #high-enough fn [] (drone :land).

convince #done "Whee! I am done." fn [] and (navdata-equal :control-state :landed)
                                            query request-is-done *land.
request *end-navstream when #done fn [] (end-navstream).</pre>
<p><iframe id="_ytid_49669" width="960" height="630" src="http://www.youtube.com/embed/CIzR8jD2d3c?enablejsapi=1&#038;origin=http://gigasquidsoftware.com&#038;autoplay=0&#038;cc_load_policy=0&#038;iv_load_policy=1&#038;loop=0&#038;modestbranding=0&#038;rel=0&#038;showinfo=1&#038;theme=dark&#038;" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe></p>
<h2>Conclusion and Thanks</h2>
<p>
I can honestly say, that this has been one of the most enjoyable programming quests. I encourage you all to look at McCarthy&#8217;s papers, Clojure, Instaparse, and of course, hacking robots. A special thanks to all the Cincy folks at <a href="http://www.neo.com/" title="http://www.neo.com/">Neo</a> who have supported me through my gentle obsessions and have let me have the freedom to follow my curiosity.</p>
]]></content:encoded>
			<wfw:commentRss>http://gigasquidsoftware.com/wordpress/?feed=rss2&#038;p=702</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Growing a Language with Clojure and Instaparse</title>
		<link>http://gigasquidsoftware.com/wordpress/?p=689</link>
		<comments>http://gigasquidsoftware.com/wordpress/?p=689#comments</comments>
		<pubDate>Thu, 02 May 2013 02:08:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Clojure]]></category>

		<guid isPermaLink="false">http://gigasquidsoftware.com/wordpress/?p=689</guid>
		<description><![CDATA[Creating your own programming language with Clojure and Instaparse is like building rainbows with s-expressions.  The Instaparse library is an elegant way of building executable parsers trees with pattern matching and standard EBNF notation for context-free grammars. Since this is my first foray into parser trees and grammars, I thought I would share my learnings in this [...]]]></description>
				<content:encoded><![CDATA[<p>Creating your own programming language with Clojure and <a title="https://github.com/Engelberg/instaparse" href="https://github.com/Engelberg/instaparse">Instaparse</a> is like building rainbows with s-expressions.  The Instaparse library is an elegant way of building executable parsers trees with pattern matching and <a title="http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form" href="http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form"><em>standard EBNF notation</em></a> for context-free grammars. Since this is my first foray into parser trees and grammars, I thought I would share my learnings in this post.</p>
<h2>Starting with a Single Word</h2>
<p>Let&#8217;s start with the simplest example:  a number.  When we start up our REPL in our brand new language, we want to be able to enter an integer, and have evaluate as an integer.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;">MyCoolLang<span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">1</span>
<span style="color: #cc66cc;">1</span></pre></td></tr></table></div>

<p>Using the instaparse library, we define a number to be a regex matching an integer.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">ns</span> coollang<span style="color: #66cc66;">.</span>parser
  <span style="color: #66cc66;">&#40;</span>:<span style="color: #555;">require</span> <span style="color: #66cc66;">&#91;</span>instaparse<span style="color: #66cc66;">.</span>core :<span style="color: #555;">as</span> insta<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">def</span> parser
  <span style="color: #66cc66;">&#40;</span>insta<span style="color: #66cc66;">/</span>parser
   <span style="color: #ff0000;">&quot;number = #'[0-9]+'&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>parser <span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;=&gt;; [:number &quot;1&quot;]</span></pre></td></tr></table></div>

<p>We now have a parser tree node that is of a type number. Pretty nice so far, but more rainbows are coming. You can make elegant transformations on the parser tree, and does them in a bottom up fashion, so you can use it for evaluation as well. In our simple number example, we are applying the read-string function on the :number node to turn it into a int.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">def</span> transform<span style="color: #66cc66;">-</span>options
  <span style="color: #66cc66;">&#123;</span>:<span style="color: #555;">number</span> read<span style="color: #66cc66;">-</span>string<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defn</span> parse <span style="color: #66cc66;">&#91;</span>input<span style="color: #66cc66;">&#93;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">-&gt;&gt;</span> <span style="color: #66cc66;">&#40;</span>parser input<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>insta<span style="color: #66cc66;">/</span>transform transform<span style="color: #66cc66;">-</span>options<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>parse <span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;=&gt; 1</span></pre></td></tr></table></div>

<h2>Adding on spaces and vectors</h2>
<p>Let&#8217;s build on a bit more. When someone enters in a sequence of numbers separated by spaces, it will be defined as a vector.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;">MyCoolLang<span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #cc66cc;">2</span> <span style="color: #cc66cc;">3</span> <span style="color: #cc66cc;">4</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span> <span style="color: #cc66cc;">2</span> <span style="color: #cc66cc;">3</span> <span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span></pre></td></tr></table></div>

<p>We need to add the notion of spaces, spaces with numbers, and vectors into our grammar, as well as the rules<br />
for evaluating these new nodes.  Notice that we use the <> notation to hide the definition in the parser tree.  The + means one or more times.  The * means 0 or more times, and the | means or.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">def</span> parser
  <span style="color: #66cc66;">&#40;</span>insta<span style="color: #66cc66;">/</span>parser
   <span style="color: #ff0000;">&quot;expr = number | vector
    vector = snumber+ number
    &lt;snumber&gt; = (number space)*
    &lt;space&gt; = &lt;#'[ ]+'&gt;
    number = #'[0-9]+'&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>parser <span style="color: #ff0000;">&quot;1 2 3 4&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;=&gt; [:expr [:vector [:number &quot;1&quot;] [:number &quot;2&quot;] [:number &quot;3&quot;] [:number &quot;4&quot;]]]</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">def</span> transform<span style="color: #66cc66;">-</span>options
  <span style="color: #66cc66;">&#123;</span>:<span style="color: #555;">number</span> read<span style="color: #66cc66;">-</span>string
   :<span style="color: #b1b100;">vector</span> <span style="color: #66cc66;">&#40;</span>comp <span style="color: #b1b100;">vec</span> list<span style="color: #66cc66;">&#41;</span>
   :<span style="color: #555;">expr</span> identity<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defn</span> parse <span style="color: #66cc66;">&#91;</span>input<span style="color: #66cc66;">&#93;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">-&gt;&gt;</span> <span style="color: #66cc66;">&#40;</span>parser input<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>insta<span style="color: #66cc66;">/</span>transform transform<span style="color: #66cc66;">-</span>options<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>parse <span style="color: #ff0000;">&quot;1 2 3 4&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;=&gt; [1 2 3 4]</span></pre></td></tr></table></div>

<h2>Adding in operations</h2>
<p>Pretty cool. We have numbers and vectors. Let&#8217;s see if we can do something fun like do some simple math on these vectors or numbers. We want it so when we type in + and some numbers, it adds them up.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;">MyCoolLang<span style="color: #66cc66;">&gt;</span> <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span> <span style="color: #cc66cc;">2</span> <span style="color: #cc66cc;">3</span> <span style="color: #cc66cc;">4</span>
<span style="color: #cc66cc;">10</span></pre></td></tr></table></div>

<p>Of course we need to further expand our grammar and rules.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">def</span> parser
  <span style="color: #66cc66;">&#40;</span>insta<span style="color: #66cc66;">/</span>parser
   <span style="color: #ff0000;">&quot;expr = number | vector | operation
    operation = operator space+ vector
    operator = '+' | '-' | '*' | '/'
    vector = snumber+ number
    &lt;snumber&gt; = (number space)*
    &lt;space&gt; = &lt;#'[ ]+'&gt;
    number = #'[0-9]+'&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>parser <span style="color: #ff0000;">&quot;+ 1 2 3 4&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;=&gt; [:expr</span>
 <span style="color: #808080; font-style: italic;">;                        [:operation</span>
 <span style="color: #808080; font-style: italic;">;                         [:operator &quot;+&quot;]</span>
 <span style="color: #808080; font-style: italic;">;                           [:vector [:number &quot;1&quot;] [:number &quot;2&quot;] [:number &quot;3&quot;] [:number &quot;4&quot;]]]</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defn</span> choose<span style="color: #66cc66;">-</span>operator <span style="color: #66cc66;">&#91;</span>op<span style="color: #66cc66;">&#93;</span>
  <span style="color: #66cc66;">&#40;</span>case op
    <span style="color: #ff0000;">&quot;+&quot;</span> <span style="color: #66cc66;">+</span>
    <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #66cc66;">-</span>
    <span style="color: #ff0000;">&quot;*&quot;</span> <span style="color: #66cc66;">*</span>
    <span style="color: #ff0000;">&quot;/&quot;</span> <span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">def</span> transform<span style="color: #66cc66;">-</span>options
  <span style="color: #66cc66;">&#123;</span>:<span style="color: #555;">number</span> read<span style="color: #66cc66;">-</span>string
   :<span style="color: #b1b100;">vector</span> <span style="color: #66cc66;">&#40;</span>comp <span style="color: #b1b100;">vec</span> list<span style="color: #66cc66;">&#41;</span>
   :<span style="color: #555;">operator</span> choose<span style="color: #66cc66;">-</span>operator
   :<span style="color: #555;">operation</span> <span style="color: #b1b100;">apply</span>
   :<span style="color: #555;">expr</span> identity<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defn</span> parse <span style="color: #66cc66;">&#91;</span>input<span style="color: #66cc66;">&#93;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">-&gt;&gt;</span> <span style="color: #66cc66;">&#40;</span>parser input<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>insta<span style="color: #66cc66;">/</span>transform transform<span style="color: #66cc66;">-</span>options<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>parse <span style="color: #ff0000;">&quot;+ 1 2 3 4&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;=&gt; 10</span></pre></td></tr></table></div>

<h2>Add a REPL</h2>
<p>All we need now is a cool REPL to start working in:<br />
We just need a main function to call our REPL, (Read &#8211; Evaluate &#8211; Print &#8211; Loop), and we are all set.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">ns</span> coollang<span style="color: #66cc66;">.</span>repl
  <span style="color: #66cc66;">&#40;</span>:<span style="color: #555;">require</span> <span style="color: #66cc66;">&#91;</span>coollang<span style="color: #66cc66;">.</span>parser :<span style="color: #555;">as</span> parser<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defn</span> repl <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">do</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">print</span> <span style="color: #ff0000;">&quot;MyCoolLang&gt; &quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>flush<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#91;</span>input <span style="color: #66cc66;">&#40;</span>read<span style="color: #66cc66;">-</span>line<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
    <span style="color: #66cc66;">&#40;</span>println <span style="color: #66cc66;">&#40;</span>parser<span style="color: #66cc66;">/</span>parse input<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">recur</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defn</span> <span style="color: #66cc66;">-</span>main <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&amp;</span>amp<span style="color: #808080; font-style: italic;">; args]</span>
  <span style="color: #66cc66;">&#40;</span>println <span style="color: #ff0000;">&quot;Hello MyCoolLang!&quot;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>println <span style="color: #ff0000;">&quot;===============&quot;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>flush<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>repl<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<h2>Closing and Inspiration</h2>
<p>I have enjoyed playing around and learning about creating programming languages with Clojure and instaparse.<br />
It truly is a beautiful library. If you need any more inspiration to start creating your own programming language, may I recommend:</p>
<ul>
<li><a title="http://www.youtube.com/watch?v=_ahvzDzKdB0" href="http://www.youtube.com/watch?v=_ahvzDzKdB0">Growing a Program Language by Guy Steele </a>- A classic and amazing talk about designing programming languages.</li>
<li><a title="https://github.com/bodil/BODOL" href="https://github.com/bodil/BODOL">BODOL</a> &#8211; A language experiment using Clojure and Instaparse</li>
</ul>
<p>Now go forth and create!</p>
]]></content:encoded>
			<wfw:commentRss>http://gigasquidsoftware.com/wordpress/?feed=rss2&#038;p=689</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Open a Coworking Space?</title>
		<link>http://gigasquidsoftware.com/wordpress/?p=667</link>
		<comments>http://gigasquidsoftware.com/wordpress/?p=667#comments</comments>
		<pubDate>Thu, 14 Mar 2013 02:32:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[All]]></category>

		<guid isPermaLink="false">http://gigasquidsoftware.com/wordpress/?p=667</guid>
		<description><![CDATA[So I am in the midst of doing something a bit crazy and a bit wonderful at the same time. I am opening a coworking space in Loveland, OH called Locolo. It is a bit crazy because it has very little chance of being profitable, I have very little free time in my life to [...]]]></description>
				<content:encoded><![CDATA[<p>So I am in the midst of doing something a bit crazy and a bit wonderful at the same time. I am opening a coworking space in Loveland, OH called <a title="http://locolo.us/" href="http://locolo.us/">Locolo</a>. It is a bit crazy because it has very little chance of being profitable, I have very little free time in my life to devote to such an undertaking, and I work full-time with awesome folks so I wouldn&#8217;t even be there during the day. Despite these very pragmatic reasons for not doing it, somewhere along the way I said F*** IT, I am doing it anyway. This blog post is an attempt to explain why.</p>
<p><img alt="Locolo" src="http://lovelandcolo.files.wordpress.com/2013/03/cropped-gallery.jpg" /></p>
<h2>I want a coworking space to exist.</h2>
<p>Coworking has changed my life. About three years ago, I became independent and starting doing development work out of my house. I found myself feeling increasingly lonely and isolated, working alone at my kitchen table day after day. I heard of a coworking space close to downtown called <a title="http://www.cincycoworks.com/" href="http://www.cincycoworks.com/">Cincy CoWorks</a>, started by the visionaries <a title="https://twitter.com/hellogerard" href="https://twitter.com/hellogerard">Gerard Sychay</a> and <a title="https://twitter.com/agilous" href="https://twitter.com/agilous">Bill Barnett</a>. I joined and started going down there to work a few days a week. It was wonderful. Work became fun again. They day was peppered with serendipitous encounters and conversations the sparked my imagination and curiosity. I got involved in the Ruby community, usergroups, and eventually became part of the EdgeCase (and now Neo) company that makes me happy every day. In fact, the people that I met coworking are still an important part of my life today. So when I heard that Cincy Coworks suspended operations, I was a bit sad. I was sad that there was no longer an environment where the coworking magic could live. I had a small thought germinate in the back of my head then, that I would like to open a coworking space one day.</p>
<h2>Someone told me it could not be done.</h2>
<p>Sometimes there are clear catalysts in life. For me, it was someone telling me that a successful coworking space in Cincinnati could not be done. They may be right. I don&#8217;t know. But I do know, that the moment I heard that, something changed. I have this little part of me that can&#8217;t stand it when someone tells me I can&#8217;t do something. In fact, it is most likely one of the reasons that went into software development in the first place. That little part of me went a grabbed that small thought about starting a coworking place and dragged it out to the front where I couldn&#8217;t ignore it any more and said &#8211; DO IT.</p>
<h2>A Lean Experiment</h2>
<p>Serendipity happens. I had just finished reading Eric Ries&#8217;s book, <a title="http://theleanstartup.com/book" href="http://theleanstartup.com/book">The Lean Startup</a>. It is a great book and highly recommend it. The main idea is using scientific methods for businesses. It got me thinking about what a coworking MVP, (minimun viable product), would be. I started looking around at spaces in Loveland just for fun, and stumbled into to one that would be perfect. I discovered <a title="http://www.studiosonmain.com/" href="http://www.studiosonmain.com/">The Loveland Art Studios on Main</a>, a old school building turned into mostly art studios, but also housed a gym, spinning center, and training field for kids. The rent was very reasonable, had a 6 month lease, and already had wifi throughout the building. It was too perfect to pass up. I defined a hypothesis and experiment on the spot.</p>
<p><em>Hypothesis</em>: There are enough people in the North and East part of Cincinnati interested to support a self-sustaining coworking space.<br />
<em>Experiment</em>: Open a small coworking space for 6 months<br />
<em>Metrics</em>: Monthly income &#8211; Monthly expenses</p>
<p>If at the end of the 6 months, the hypothesis is proven incorrect, I will accept my outcome and close up shop. However, even if the experiment is not successful, I will be capturing metrics on this and other experiments to save as artifacts to share with others that come after me. Hopefully, it will make it better and easier for the next person to launch coworking spaces. If you are interested in monthly updates on my metrics and experiments, ping me, and I will happily add you to my monthly distribution list.</p>
<h2>Doing something you believe in</h2>
<p>I don&#8217;t think this part needs much explaining. Doing something you believe in is worthwhile just in itself. Enough said.</p>
<h2>Getting involved in the community is magic</h2>
<p>Starting up a coworking space is all about building community. The very act of building something together creates magic. I am so thankful for all the people that have pitched in a helped me with their advice, encouragement, and assistance so far. Shout outs to <a title="https://twitter.com/agilous" href="https://twitter.com/agilous">Bill Barnett</a>, <a title="https://twitter.com/hellogerard" href="https://twitter.com/hellogerard">Gerard Sychay</a>, <a title="https://twitter.com/p9k" href="https://twitter.com/p9k">Paul Heinrich</a>, <a title="https://twitter.com/jacki890" href="https://twitter.com/jacki890">Jacki Keys</a>, <a title="https://twitter.com/ElizabethN" href="https://twitter.com/ElizabethN">Elizabeth Naramore</a>, <a title="https://twitter.com/cdmwebs" href="https://twitter.com/cdmwebs">Chris Moore</a>, <a title="https://twitter.com/rabiedenharn" href="https://twitter.com/rabiedenharn">Rob Biederhorn</a>, <a title="https://twitter.com/masondesu" href="https://twitter.com/masondesu">Mason Stewart</a>, and others. You all rock. really.</p>
<h2>An Excuse for a Biscuit Tasting</h2>
<p><a href="http://gigasquidsoftware.com/wordpress/wp-content/uploads/2013/03/biscuits.jpg"><img class="alignleft size-medium wp-image-671" alt="biscuits" src="http://gigasquidsoftware.com/wordpress/wp-content/uploads/2013/03/biscuits-225x300.jpg" width="225" height="300" /></a></p>
<p>One of the fun perks of running a coworks is you get to have Open Houses and other excuses to eat biscuits. When I say &#8220;biscuits&#8221;, I mean biscuits in the British form, that translates into American as &#8220;delicious cookies&#8221;. So if you are in Cincinnati, sign up for the <a title="http://lovelandcolo.wordpress.com/" href="http://lovelandcolo.wordpress.com/">Open House of Locolo</a>. Where you can not only see the space and meet awesome people, but also rate various cookies on important factors such as dunkablility and crunchiness.</p>
<p>Thanks &amp; Toodles for now,</p>
<p>Carin</p>
]]></content:encoded>
			<wfw:commentRss>http://gigasquidsoftware.com/wordpress/?feed=rss2&#038;p=667</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The Joy of Flying AR Drones with Clojure</title>
		<link>http://gigasquidsoftware.com/wordpress/?p=645</link>
		<comments>http://gigasquidsoftware.com/wordpress/?p=645#comments</comments>
		<pubDate>Tue, 05 Feb 2013 03:45:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Clojure]]></category>

		<guid isPermaLink="false">http://gigasquidsoftware.com/wordpress/?p=645</guid>
		<description><![CDATA[Clojure is fun.  Flying AR Parrot Drones are fun.  Put them together and there is pure joy. Ever since I found out that you could program and control your drone over UDP, I couldn&#8217;t wait to try it out in Clojure.  I had dreams of controlling it with my Emacs REPL.  That dream came true [...]]]></description>
				<content:encoded><![CDATA[<p>Clojure is fun.  Flying <a title="http://ardrone2.parrot.com/usa/" href="http://ardrone2.parrot.com/usa/">AR Parrot Drones</a> are fun.  Put them together and there is pure joy.</p>
<p>Ever since I found out that you could program and control your<a href="http://gigasquidsoftware.com/wordpress/wp-content/uploads/2013/02/drone.jpg"><img class="alignleft size-medium wp-image-649" title="drone" src="http://gigasquidsoftware.com/wordpress/wp-content/uploads/2013/02/drone-e1360035448767-225x300.jpg" alt="" width="225" height="300" /></a> drone over UDP, I couldn&#8217;t wait to try it out in Clojure.  I had dreams of controlling it with my Emacs REPL.  That dream came true and it has been a true joy to fly in a function language. This blog post shows some of the features that the <a title="https://github.com/gigasquid" href="https://github.com/gigasquid">clj-drone project</a> has so far.  There is still a bit of work to go to make it complete.  But, I wanted to share and hopefully encourage others to start playing with it too.</p>
<h2>The Simple Take-off and Landing</h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">ns</span> clj<span style="color: #66cc66;">-</span>drone<span style="color: #66cc66;">.</span>example<span style="color: #66cc66;">.</span>simple
  <span style="color: #66cc66;">&#40;</span>:<span style="color: #555;">require</span> <span style="color: #66cc66;">&#91;</span>clj<span style="color: #66cc66;">-</span>drone<span style="color: #66cc66;">.</span>core :<span style="color: #b1b100;">refer</span> :<span style="color: #555;">all</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>drone<span style="color: #66cc66;">-</span>initialize<span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;Use ip and port for non-standard drone ip/port</span>
<span style="color: #808080; font-style: italic;">;(initialize ip port)</span>
<span style="color: #66cc66;">&#40;</span>drone :<span style="color: #555;">take</span><span style="color: #66cc66;">-</span>off<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>Thread<span style="color: #66cc66;">/</span>sleep <span style="color: #cc66cc;">10000</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>drone :<span style="color: #555;">land</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>Here is a video of executing the entire program in nrepl/ emacs<br />
<iframe id="_ytid_28819" width="960" height="630" src="http://www.youtube.com/embed/IjKDZVUk1M8?enablejsapi=1&#038;origin=http://gigasquidsoftware.com&#038;autoplay=0&#038;cc_load_policy=0&#038;iv_load_policy=1&#038;loop=0&#038;modestbranding=0&#038;rel=0&#038;showinfo=1&#038;theme=dark&#038;" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe></p>
<h2>Controlling the Drone with Emacs/ Clojure REPL</h2>
<p>Running the program all at once to control the drone is fun. But, I prefer to have more control over it in flight. I find being able to execute commands with keystrokes in emacs, the best way to do it. Here is a short video demonstrating control via the REPL. (Note: I am just doing simple take off / up and landings because of the constraints of flying indoors in my kitchen. There are many more moves you can do if you have more space.)</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">ns</span> clj<span style="color: #66cc66;">-</span>drone<span style="color: #66cc66;">.</span>example<span style="color: #66cc66;">.</span>moves
  <span style="color: #66cc66;">&#40;</span>:<span style="color: #555;">require</span> <span style="color: #66cc66;">&#91;</span>clj<span style="color: #66cc66;">-</span>drone<span style="color: #66cc66;">.</span>core :<span style="color: #b1b100;">refer</span> :<span style="color: #555;">all</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>drone<span style="color: #66cc66;">-</span>initialize<span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;Use ip and port for non-standard drone ip/port</span>
<span style="color: #808080; font-style: italic;">;(initialize ip port)</span>
<span style="color: #66cc66;">&#40;</span>drone<span style="color: #66cc66;">-</span>do<span style="color: #66cc66;">-</span><span style="color: #b1b100;">for</span> <span style="color: #cc66cc;">4</span> :<span style="color: #555;">take</span><span style="color: #66cc66;">-</span>off<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>drone<span style="color: #66cc66;">-</span>do<span style="color: #66cc66;">-</span><span style="color: #b1b100;">for</span> <span style="color: #cc66cc;">2</span> :<span style="color: #555;">up</span> <span style="color: #cc66cc;">0.3</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>drone<span style="color: #66cc66;">-</span>do<span style="color: #66cc66;">-</span><span style="color: #b1b100;">for</span> <span style="color: #cc66cc;">3.75</span> :<span style="color: #555;">fly</span> <span style="color: #cc66cc;">0.2</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">; sprial</span>
<span style="color: #66cc66;">&#40;</span>drone :<span style="color: #555;">hover</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>drone :<span style="color: #555;">land</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p><iframe id="_ytid_12390" width="960" height="630" src="http://www.youtube.com/embed/kNLx5X49Lig?enablejsapi=1&#038;origin=http://gigasquidsoftware.com&#038;autoplay=0&#038;cc_load_policy=0&#038;iv_load_policy=1&#038;loop=0&#038;modestbranding=0&#038;rel=0&#038;showinfo=1&#038;theme=dark&#038;" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe></p>
<h2>Looking at the Navigation Data</h2>
<p>You can also hook into the navigation feed. There are many drone states and properties to look at. There is a list of all the ones currently available on the <a title="https://github.com/gigasquid/clj-drone" href="https://github.com/gigasquid/clj-drone">github project site</a>. There are also many more, including targeting information, that have yet to be added. There is a logging function that will pair down the navigation properties that you are interested in. The navigation data map as an atom, so it can be de-referenced anywhere in your program. Here is a short video of what the navigation logging data looks like when it is turned on.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">ns</span> clj<span style="color: #66cc66;">-</span>drone<span style="color: #66cc66;">.</span>example<span style="color: #66cc66;">.</span>nav<span style="color: #66cc66;">-</span>test
  <span style="color: #66cc66;">&#40;</span>:<span style="color: #555;">require</span> <span style="color: #66cc66;">&#91;</span>clj<span style="color: #66cc66;">-</span>drone<span style="color: #66cc66;">.</span>core :<span style="color: #b1b100;">refer</span> :<span style="color: #555;">all</span><span style="color: #66cc66;">&#93;</span>
            <span style="color: #66cc66;">&#91;</span>clj<span style="color: #66cc66;">-</span>drone<span style="color: #66cc66;">.</span>navdata :<span style="color: #b1b100;">refer</span> :<span style="color: #555;">all</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;; logging is configured to go to the logs/drone.log file</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>set<span style="color: #66cc66;">-</span>log<span style="color: #66cc66;">-</span>data <span style="color: #66cc66;">&#91;</span>:<span style="color: #555;">seq</span><span style="color: #66cc66;">-</span>num :<span style="color: #555;">flying</span> :<span style="color: #555;">battery</span><span style="color: #66cc66;">-</span>percent :<span style="color: #555;">control</span><span style="color: #66cc66;">-</span>state :<span style="color: #555;">roll</span> :<span style="color: #555;">pitch</span> :<span style="color: #555;">yaw</span>
                :<span style="color: #555;">velocity</span><span style="color: #66cc66;">-</span>x :<span style="color: #555;">velocity</span><span style="color: #66cc66;">-</span>y :<span style="color: #555;">velocity</span><span style="color: #66cc66;">-</span>z<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>drone<span style="color: #66cc66;">-</span>initialize<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>drone<span style="color: #66cc66;">-</span>init<span style="color: #66cc66;">-</span>navdata<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>drone :<span style="color: #555;">take</span><span style="color: #66cc66;">-</span>off<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>drone :<span style="color: #555;">land</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>end<span style="color: #66cc66;">-</span>navstream<span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p><iframe id="_ytid_54602" width="960" height="630" src="http://www.youtube.com/embed/peQTVvsayrA?enablejsapi=1&#038;origin=http://gigasquidsoftware.com&#038;autoplay=0&#038;cc_load_policy=0&#038;iv_load_policy=1&#038;loop=0&#038;modestbranding=0&#038;rel=0&#038;showinfo=1&#038;theme=dark&#038;" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe></p>
<h2>Auto-piloting with goals and beliefs</h2>
<p>Inspired by reading John McCarthy&#8217;s paper on <a title="http://www-formal.stanford.edu/jmc/ascribing/ascribing.html" href="http://www-formal.stanford.edu/jmc/ascribing/ascribing.html">Ascribing Mental Qualities to Machines</a>, the drone can also auto-pilot itself based on goals and beliefs about its streaming navigation data. You define belief-actions and then goals. Finally, you set a vector of the current goals for the drone to process. You can see an example here of the AR drone having three goals: Take off, Get to a cruising altitude, and then land. It does it solely by inspecting and acting on the streaming navigation data.<br />
Code for the program is here: <a title="https://github.com/gigasquid/clj-drone/blob/master/examples/nav_goals.clj" href="https://github.com/gigasquid/clj-drone/blob/master/examples/nav_goals.clj">https://github.com/gigasquid/clj-drone/blob/master/examples/nav_goals.clj</a><br />
<iframe id="_ytid_96218" width="960" height="630" src="http://www.youtube.com/embed/ujqeKFT8HdQ?enablejsapi=1&#038;origin=http://gigasquidsoftware.com&#038;autoplay=0&#038;cc_load_policy=0&#038;iv_load_policy=1&#038;loop=0&#038;modestbranding=0&#038;rel=0&#038;showinfo=1&#038;theme=dark&#038;" frameborder="0" allowfullscreen type="text/html" class="__youtube_prefs__"></iframe></p>
<h2>Go Fly!</h2>
<p>I have had a lot of fun so far working on this project. I hope that you get a chance to play with it too. The project is still very young, so stay tuned for updates and, of course, pull requests are always welcome :)</p>
]]></content:encoded>
			<wfw:commentRss>http://gigasquidsoftware.com/wordpress/?feed=rss2&#038;p=645</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>7 McCarthy Papers in 7ish weeks #7 &#8211; Elephant 2000</title>
		<link>http://gigasquidsoftware.com/wordpress/?p=640</link>
		<comments>http://gigasquidsoftware.com/wordpress/?p=640#comments</comments>
		<pubDate>Wed, 02 Jan 2013 00:30:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[John McCarthy Papers]]></category>

		<guid isPermaLink="false">http://gigasquidsoftware.com/wordpress/?p=640</guid>
		<description><![CDATA[Saving the best for last.  Elephant 2000 To be continued&#8230;.]]></description>
				<content:encoded><![CDATA[<p>Saving the best for last.  <a title="http://www-formal.stanford.edu/jmc/elephant/elephant.html" href="http://www-formal.stanford.edu/jmc/elephant/elephant.html">Elephant 2000</a></p>
<p>To be continued&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://gigasquidsoftware.com/wordpress/?feed=rss2&#038;p=640</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hobby Languages for Clojurists</title>
		<link>http://gigasquidsoftware.com/wordpress/?p=560</link>
		<comments>http://gigasquidsoftware.com/wordpress/?p=560#comments</comments>
		<pubDate>Wed, 26 Dec 2012 21:58:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Clojure]]></category>

		<guid isPermaLink="false">http://gigasquidsoftware.com/wordpress/?p=560</guid>
		<description><![CDATA[I spend most of my work day in Ruby and CoffeeScript. However, my true love belongs to Clojure, which I consider my &#8220;hobby&#8221; language right now. I started to wonder, what are the &#8220;hobby&#8221; languages for people who spend most of their work day with Clojure. My informal twitter poll revealed selection as diverse and [...]]]></description>
				<content:encoded><![CDATA[<p>I spend most of my work day in Ruby and CoffeeScript. However, my true love belongs to Clojure, which I consider my &#8220;hobby&#8221; language right now. I started to wonder, what are the &#8220;hobby&#8221; languages for people who spend most of their work day with Clojure. My informal twitter poll revealed selection as diverse and interesting as the Clojurists themselves.</p>
<p><strong>Developers Who Enjoy Clojure Also Enjoy: </strong><br />
<em>(In no particular order)</em></p>
<ul>
<li><a title="http://golang.org/" href="http://golang.org/">Go</a> (adorable mascot)</li>
<li><a title="http://ocaml.org/" href="http://ocaml.org/">OCaml</a></li>
<li><a title="http://factorcode.org/" href="http://factorcode.org/">Factor</a></li>
<li><a title="http://www.haskell.org/haskellwiki/Haskell" href="http://www.haskell.org/haskellwiki/Haskell">Haskell</a></li>
<li><a title="http://www.scala-lang.org/" href="http://www.scala-lang.org/">Scala</a></li>
<li><a title="http://julialang.org/" href="http://julialang.org/">Julia</a></li>
<li><a title="http://www.bayfronttechnologies.com/metaii.html" href="http://www.bayfronttechnologies.com/metaii.html">MetaII</a></li>
<li><a title="https://github.com/Fogus/caerbannog" href="https://github.com/Fogus/caerbannog">caerbannog</a></li>
<li><a title="http://www.jsoftware.com/" href="http://www.jsoftware.com/">J</a></li>
<li><a title="http://boo.codehaus.org/" href="http://boo.codehaus.org/">Boo</a> (.Net)</li>
<li>JavaScript / Bash</li>
</ul>
<p>and of course <strong>MORE Clojure</strong></p>
<ul>
<li><a title="https://github.com/clojure/clojurescript" href="https://github.com/clojure/clojurescript">ClojureScript</a></li>
<li><a title="https://github.com/clojure/core.logic" href="https://github.com/clojure/core.logic">core.logic</a></li>
<li><a title="http://overtone.github.com" href="http://overtone.github.com">Overtone</a></li>
<li><a title="https://github.com/quil/quil" href="https://github.com/quil/quil">Quil</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://gigasquidsoftware.com/wordpress/?feed=rss2&#038;p=560</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>7 McCarthy Papers in 7ish Weeks #5 &amp; #6 &#8211; SDFW Tic-Tac-Toe</title>
		<link>http://gigasquidsoftware.com/wordpress/?p=557</link>
		<comments>http://gigasquidsoftware.com/wordpress/?p=557#comments</comments>
		<pubDate>Sun, 25 Nov 2012 14:08:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Clojure]]></category>
		<category><![CDATA[John McCarthy Papers]]></category>

		<guid isPermaLink="false">http://gigasquidsoftware.com/wordpress/?p=557</guid>
		<description><![CDATA[This holiday edition blog post covers two McCarthy papers instead of just one.  We will be talking about Free Will &#8211; Even for Robots and the companion paper Simple Deterministic Free Will. In which we deftly sidestep the philosophers We know that computers and programs are completely deterministic.  A philosophical question is whether we, as humans [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://gigasquidsoftware.com/wordpress/wp-content/uploads/2012/11/sdfwtictactoe.png"><img class="alignright size-medium wp-image-635" title="SDFW Tic Tac Toe" src="http://gigasquidsoftware.com/wordpress/wp-content/uploads/2012/11/sdfwtictactoe-300x276.png" alt="SDFW Tic Tac Toe" width="300" height="276" /></a></p>
<p>This holiday edition blog post covers two McCarthy papers instead of just one.  We will be talking about <a title="http://www-formal.stanford.edu/jmc/freewill.pdf" href="http://www-formal.stanford.edu/jmc/freewill.pdf">Free Will &#8211; Even for Robots</a> and the companion paper <a title="http://www-formal.stanford.edu/jmc/freewill2.pdf" href="http://www-formal.stanford.edu/jmc/freewill2.pdf">Simple Deterministic Free Will</a>.</p>
<h2>In which we deftly sidestep the philosophers</h2>
<p>We know that computers and programs are completely deterministic.  A philosophical question is whether we, as humans are ruled by determinism, (although complex it may be), or not.  If we take the decision that humans are deterministic, then we can argue that either there is no free will &#8211; or that free will is &#8220;compatible&#8221; with determinism.  Philosophers, of course, could discuss such questions interminably, trying to get a theory to fit for all people and all occasions.  Thankfully, McCarthy takes a very admirable and practical view on free will.  Let&#8217;s try out something simple for a computer program and see how it works.  He explores a philosophy &#8221;Compatibilist&#8217;s&#8221; view, which regards a person to have free will if his actions are decided by an internal process, even if this process itself is deterministic.  But by exploring this view with computer programs, he makes clear:</p>
<blockquote><p>&#8230; I don&#8217;t need to take a position on determinism itself.</p>
<p>&nbsp;</p></blockquote>
<h2>Simple Deterministic Free Will</h2>
<p>So what would Free Will look like for a machine. How do we go about defining it? McCarthy proposes the idea of Simple Deterministic Free Will. The main idea is that the mechanism of free will is broken up into two parts. The first part looks at the possible actions and the consequences of those actions, and the second part decides which of those actions are preferable and does them. He gives the example of a chess program:</p>
<blockquote><p>People and chess programs carry thinking about choice beyond the ﬁrst level. Thus “If I make this move, my opponent (or nature regarded as an opponent) will have the following choices, each of which will give me further choices.” Examining such trees of possibilities is an aspect of free will in the world, but the simplest form of free will in a deterministic world does not involve branching more than once.</p></blockquote>
<p>So perhaps we could find an example that is simpler than chess to work with &#8230;</p>
<blockquote><p>&#8230;it would be interesting to design the simplest possible system exhibiting deterministic free will. A program for tic-tac-toe is simpler than a chess program, but the usual program does consider choices.</p></blockquote>
<h2>Simple Deterministic Free Will Tic Tac Toe</h2>
<p>So to explore McCarthy&#8217;s idea of Simple Deterministic Free Will, I decided to try to construct a game of Tic Tac Toe with SDFW principles. Coincidentally, my six year old daughter, just learned how to play Tic Tac Toe as well. I wanted to construct a program that would &#8220;reason&#8221; about the game as would a child. Even though the game of Tic Tac Toe is simple enough to have all the possibility trees of moves completely solved, this is not how a my daughter approaches the game. Each time it is her move, she only looks one move ahead to see if she can win three in a row, or if she needs to block her opponent from winning the next move.</p>
<h2>My Tic Tac Toe Program has Beliefs</h2>
<p>It has three beliefs to be precise. It believes that no one is going to win, or it is going to win, or its opponent is going to win.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">def</span> beliefs
  <span style="color: #66cc66;">&#123;</span> :<span style="color: #555;">win</span> <span style="color: #ff0000;">&quot;I am going to win.&quot;</span>
    :<span style="color: #555;">lose</span> <span style="color: #ff0000;">&quot;My opponent is going to win.&quot;</span>
    :<span style="color: #555;">noone</span> <span style="color: #ff0000;">&quot;No one is going to win.&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>McCarthy thinks that <a title="http://gigasquidsoftware.com/wordpress/?p=477" href="http://gigasquidsoftware.com/wordpress/?p=477">ascribing programs beliefs can be useful</a>. One of the reasons is that it helps us as humans, reason and debug our programs. I definitely saw the value of this when I was trying to debug my tic tac toe game. After it failed to block my winning move, I could see what its false belief was &#8211; ah &#8211; it thought that &#8220;No one is going to win&#8221;. I wrote another failing unit test to fix its bad belief.</p>
<h2>My Tic Tac Toe Program Looks to See What Its Possible Actions and Preferences Are</h2>
<p>It looks at the board and computes all its possible next moves. Then it computes all the possible next moves of its opponent. It looks at the consequences of these moves by assigning a belief from one of its three beliefs. Next, it ranks the moves according to the preference of its beliefs.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="clojure" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">def</span> belief<span style="color: #66cc66;">-</span>action<span style="color: #66cc66;">-</span>preferences
  <span style="color: #66cc66;">&#123;</span> <span style="color: #66cc66;">&#40;</span>beliefs :<span style="color: #555;">win</span><span style="color: #66cc66;">&#41;</span> <span style="color: #cc66cc;">1</span>
    <span style="color: #66cc66;">&#40;</span>beliefs :<span style="color: #555;">lose</span><span style="color: #66cc66;">&#41;</span> <span style="color: #cc66cc;">2</span>
    <span style="color: #66cc66;">&#40;</span>beliefs :<span style="color: #555;">noone</span><span style="color: #66cc66;">&#41;</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>It then chooses the move to take that has the highest rank. If it believes that no-one is going to win, I opted to have it choose a random move from the list of possible choices. But this randomness is completely arbitrary on my part and not necessary to SDFW at all.</p>
<h2>Why ClojureScript is Awesome</h2>
<p>I coded the core tic-tac-toe program in Clojure, but then I thought that having a web page UI would be nice for my daughter to play with. So, I just took the game logic and moved it to ClojureScript. Let me say that again slower&#8230; I used the same code on the server on the browser. Awesome. Using the <a title="https://github.com/emezeske/lein-cljsbuild/blob/0.2.10/doc/CROSSOVERS.md" href="https://github.com/emezeske/lein-cljsbuild/blob/0.2.10/doc/CROSSOVERS.md">lein-cljsbuild crossover support</a>, I was able to simply configure my UI ClojureScript code to access my regular clojure game engine. Very cool. I was also very pleased to work with the <a title="https://github.com/levand/domina" href="https://github.com/levand/domina">https://github.com/levand/domina</a> DOM manipulation library for ClojureScript.</p>
<h2>End Result</h2>
<p>It was a fun project that let me play with ClojureScript, explore McCarthy&#8217;s free will for robots, have some very interesting conversations about free will with my co-wokers and code and coffee friends, and make a game for my daughter to play and enjoy. If you are interested in checking out the program for yourself &#8211; <a title="http://gigasquid.github.com/sdfw-tic-tac-toe/" href="http://gigasquid.github.com/sdfw-tic-tac-toe/">http://gigasquid.github.com/sdfw-tic-tac-toe/</a>. The last belief is displayed at the bottom. I have only tried it on Chrome, so beware. Finally, if you find any false beliefs, feel free to submit a pull request to <a title="https://github.com/gigasquid/sdfw-tic-tac-toe" href="https://github.com/gigasquid/sdfw-tic-tac-toe">https://github.com/gigasquid/sdfw-tic-tac-toe</a>.</p>
<p>P.S. If you are wondering, I drew the awesome graphics all by myself.</p>
]]></content:encoded>
			<wfw:commentRss>http://gigasquidsoftware.com/wordpress/?feed=rss2&#038;p=557</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>7 McCarthy Papers in 7ish Weeks &#8211; #4</title>
		<link>http://gigasquidsoftware.com/wordpress/?p=543</link>
		<comments>http://gigasquidsoftware.com/wordpress/?p=543#comments</comments>
		<pubDate>Tue, 06 Nov 2012 13:32:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[John McCarthy Papers]]></category>

		<guid isPermaLink="false">http://gigasquidsoftware.com/wordpress/?p=543</guid>
		<description><![CDATA[Reading Artificial Intelligence, Logic, and Formalizing Common Sense, led me surprisingly to reflect on, not only logic and philosophy, but also the history and present state of AI. Fist let&#8217;s look at the kind of AI that McCarthy is describing in paper. He talks of a program that can use common sense knowledge about the [...]]]></description>
				<content:encoded><![CDATA[<p>Reading <a href="http://www-formal.stanford.edu/jmc/ailogic/ailogic.html" title="http://www-formal.stanford.edu/jmc/ailogic/ailogic.html">Artificial Intelligence, Logic, and Formalizing Common Sense</a>, led me surprisingly to reflect on, not only logic and philosophy, but also the history and present state of AI.</p>
<p>Fist let&#8217;s look at the kind of AI that McCarthy is describing in paper. He talks of a program that can use common sense knowledge about the world around it and have this knowledge structured well enough that it can be reasoned about mathematically. In fact, he describes four levels of logic:</p>
<ol>
<li>The computer program has its &#8220;beliefs&#8221; completely defined by its internal state.  If you are confused by the term &#8220;beliefs&#8221;, it refers to <a href="http://gigasquidsoftware.com/wordpress/?p=477" title="http://gigasquidsoftware.com/wordpress/?p=477">ascribing mental qualities to machines</a>.  In his famous example, a thermostat has three beliefs: the room is too hot, the room is too cold, and the room is just right.
<li>The programs express their beliefs in sentences in machine memory.  However, they do not use ordinary logic.  They use other methods like rules and procedures.
<li>In addition to expresses their beliefs in sentences, they also use first order logic and logical deduction to reach their conclusions.
<li>The fourth level is still a goal today.  It is to have the program represent general facts about the world as logical sentences.  Furthermore, to have a database of these commonsense facts that programs can share.
</ol>
<p>Let&#8217;s step back now for a moment, to a excerpt from the very beginning of the paper:</p>
<blockquote><p>
One path to human-level AI uses mathematical logic to formalize common-sense knowledge in such a way that common-sense problems can be solved by logical reasoning. This methodology requires understanding the common-sense world well enough to formalize facts about it and ways of achieving goals in it. Basing AI on understanding the common-sense world is different from basing it on understanding human psychology or neurophysiology.</p></blockquote>
<p>This approach to AI is just one approach. It is commonly referred to as a &#8220;top down&#8221; approach.  In the early years of AI it was the dominant way of thinking about things. Looking back at the history of AI, the <a href="http://en.wikipedia.org/wiki/History_of_artificial_intelligence#The_golden_years_1956.E2.88.921974" title="http://en.wikipedia.org/wiki/History_of_artificial_intelligence#The_golden_years_1956.E2.88.921974">golden years</a> were full of optimism, (and funding), that this was the path to achieving fully intelligent machines.  Disenchantment with unfulfilled promises, led to the first <a href="http://en.wikipedia.org/wiki/AI_winter" title="http://en.wikipedia.org/wiki/AI_winter">AI winter</a>.  There was a rise of expert systems later on that limited their scope to small domains and avoided the common sense problem, but eventually ended in a second AI winter and ushered in our current world.  This basic approach is an opposite ground-up view of AI.  It uses neural networks and statistics from a physical inspiration.  Some of this inspiration is from human neurophysiology, some of it is from insect and animal world, but simplicity behavior of a &#8220;body&#8221; is emphasized.  With the advances in hardware and computing power today, the innovations and accomplishments have been breath taking.</p>
<p>A good example of the two approaches can be seen in my Roomba.  A top down approach, would require my Roomba to have a complete room model in its program.  It would have to understand what my couch was, where the doors where and have logically reasoning to direct it to which areas to clean and when to stop cleaning and recharge itself.  The creators of the Roomba were from the opposite camp of thinking.  They took the simpler behavior approach of having the Roomba just take a random walk in the room and turn around when it ran into an obstacle.  It took a bit longer to get the room clean in such a random fashion, but not having to deal with the overhead of a mental model was well worth the trade off.</p>
<p>Noam Chomsky recently argued that the<a href="http://www.theatlantic.com/technology/archive/2012/11/noam-chomsky-on-where-artificial-intelligence-went-wrong/261637/" title="http://www.theatlantic.com/technology/archive/2012/11/noam-chomsky-on-where-artificial-intelligence-went-wrong/261637/"> pendulum has swung too far in favor of this simplified behaviorist approach</a>. Even in the light of <a href="http://norvig.com/chomsky.html" title="http://norvig.com/chomsky.html">Norvig&#8217;s response</a>, I think Chomsky has a point.  We would do well to search for gems of true intelligent systems in the historical landscape of the AI Winter.  Some of the breakthroughs of current sheer computing power and new modeling techniques, might yield great fruits.</p>
<p>One of the comments by nagelonce, on the Chomsky article,  puts this very well:</p>
<blockquote><p>AI has a hole in the middle. There&#8217;s top-down AI, which focuses on abstractions and reductionism. There&#8217;s bottom-up AI, which focuses on reactive systems and the front end of visual processing. They have yet to meet in the middle. They are, however, much closer to doing so than they were twenty years ago.
</p></blockquote>
<p>If you are interested in checking out a top-down open source AI project, take a look at <a href="http://www.opencyc.org/doc" title="http://www.opencyc.org/doc">OpenCyc</a>.  After a brief look at it the other night, it suffers from the lack of love and documentation.  But, I can also see the promise of McCarthy&#8217;s common sense knowledge and logic system, covered in a thin layer of snow.</p>
]]></content:encoded>
			<wfw:commentRss>http://gigasquidsoftware.com/wordpress/?feed=rss2&#038;p=543</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>7 John McCarthy Papers in 7 Weeks #3</title>
		<link>http://gigasquidsoftware.com/wordpress/?p=515</link>
		<comments>http://gigasquidsoftware.com/wordpress/?p=515#comments</comments>
		<pubDate>Mon, 15 Oct 2012 01:37:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[John McCarthy Papers]]></category>

		<guid isPermaLink="false">http://gigasquidsoftware.com/wordpress/?p=515</guid>
		<description><![CDATA[In which I realize that John McCarthy is the father of the Semantic Web I have realized that it generally takes me more than a week to read a paper, reflect on it, experiment, and finally blog about it. But, since I made up the rules of the project in the first place,  I am [...]]]></description>
				<content:encoded><![CDATA[<p><strong>In which I realize that John McCarthy is the father of the Semantic Web</strong></p>
<p>I have realized that it generally takes me more than a week to read a paper, reflect on it, experiment, and finally blog about it. But, since I made up the rules of the project in the first place,  I am not going to dwell on the time frame and just move forward with the next paper.</p>
<p>When I picked the paper <a title="FIRST ORDER THEORIES OF INDIVIDUAL CONCEPTS AND PROPOSITIONS" href="http://www-formal.stanford.edu/jmc/concepts/concepts.html">First Order Theories of Individual Concepts and Propositions</a>, I thought to myself that it would be a rather narrow, more self contained paper than the first two broad papers that I read. However, the connections that it drew to current technologies caught me by surprise.</p>
<p>The main point of the paper is how to formalize language statements, including concepts, so that a computer can apply mathematical rules and logic to them. McCarthy had mentioned concepts and thoughts in his &#8220;Ascribing Mental Qualities&#8221; paper, where he says:</p>
<blockquote><p>&#8220;..the deep structure&#8221; of a publicly expressible thought is a node is the public network.&#8221;</p></blockquote>
<p>This immediately brought to my mind the Semantic Web.   In Semantic Web, data is structured in <a title="RDF" href="http://www.w3.org/TR/rdf-primer/#statements">RDF</a> statements as triples &#8211; &lt;subject&gt; &lt;predicate&gt; &lt;object&gt;.  The data contained in these triples are structured and described so that machines can derive context and meaning from it.  For example, instead of just putting  &#8221;cat&#8221; as the subject.  In RDF you would use <a href="http://dbpedia.org/resource/Cat">http://dbpedia.org/resource/Cat</a> as the subject. Which, is pretty much dead on McCarthy&#8217;s expressible thought as a node in the public network.</p>
<p>McCarthy uses the following example to illustrate how to construct First Order statements.</p>
<blockquote><p>Frege (1892) discussed the need to distinguish direct and indirect use of words. According to one interpretation of Frege&#8217;s ideas, the meaning of the phrase &#8220;Mike&#8217;s telephone number&#8221; in the sentence &#8220;Pat knows Mike&#8217;s telephone number&#8221; is the concept of Mike&#8217;s telephone number, whereas its meaning in the sentence &#8220;Pat dialed Mike&#8217;s telephone number&#8221; is the number itself. Thus if we also have Mary&#8217;s telephone number = Mike&#8217;s telephone number&#8221;, then Pat dialed Mary&#8217;s telephone number&#8221; follows, but &#8220;Pat knows Mary&#8217;s telephone number does not. phone number&#8221; is the number itself. Thus if we also have Mary&#8217;s telephone number = Mike&#8217;s telephone number&#8221;, then Pat dialed Mary&#8217;s telephone number&#8221; follows, but Pat knows Mary&#8217;s telephone number does not.</p></blockquote>
<p>McCarthy express the statement &#8220;Pat knows Mike&#8217;s telephone number&#8221; as:</p>
<blockquote><p>true Know(Pat; Telephone Mike)</p></blockquote>
<p>He then uses more formalized statements to derive logic statements and reasoning from this example.</p>
<p>At this point, I was seeing more connections to the field of Semantic Web. Expressing data in RDF/ OWL gives computers exactly this type of logic and reasoning ability too.</p>
<p>So how would you go about expressing &#8220;Pat knows Mike&#8217;s telephone number&#8221; in Semantic Web data form?   This question is not a simple one,(at least for me),  because there are so many different ways that you can construct RDF.  The choices were a bit overwhelming.</p>
<p>One option might be to use RDF reification, in which you can make statements about statements.  Another option might be using OWL classes and properties.  There are some excellent answers when I posed the question on <a title="Stack Overflow" href="http://stackoverflow.com/questions/13114018/how-to-state-pat-knows-mikes-telephone-number-in-rdf-owl">http://stackoverflow.com/questions/13114018/how-to-state-pat-knows-mikes-telephone-number-in-rdf-owl.</a></p>
<p>Indeed, it seems that we can express individual concepts and propositions in Semantic Web form quite well.  I had not realized that John McCarthy is the father of Sematic Web as well.</p>
<p>In closing, he speaks of AI Applications. Reasoning and predication are familiar applications that we use today. However he hits upon one that is quite interesting to me. That is &#8220;..determining that it <strong>does not know </strong>something or that someone else doesn&#8217;t.&#8221; This is not a common area to think about with computer programs. We are usually much more focused on what it does know and how to reason about it. But, if we are really to build intelligent, learning systems, we need to be able to identify what it does not know as well.  Perhaps then the AI can help us humans, who are pretty bad at that too.</p>
]]></content:encoded>
			<wfw:commentRss>http://gigasquidsoftware.com/wordpress/?feed=rss2&#038;p=515</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>7 John McCarthy Papers in 7 Weeks &#8211; #2</title>
		<link>http://gigasquidsoftware.com/wordpress/?p=504</link>
		<comments>http://gigasquidsoftware.com/wordpress/?p=504#comments</comments>
		<pubDate>Sat, 29 Sep 2012 16:00:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[John McCarthy Papers]]></category>

		<guid isPermaLink="false">http://gigasquidsoftware.com/wordpress/?p=504</guid>
		<description><![CDATA[Well, life threw me for a bit of a loop and delayed my post on my second paper. So I am going to consider this a &#8220;weekish&#8221; period of time and just continue on. I read Towards a Mathematical Science of Computation. It is quite a meaty paper and was certainly a lot to digest. [...]]]></description>
				<content:encoded><![CDATA[<p>Well, life threw me for a bit of a loop and delayed my post on my second paper. So I am going to consider this a &#8220;weekish&#8221; period of time and just continue on.</p>
<p>I read <a title="Towards a Mathematical Science of Computation" href="http://www-formal.stanford.edu/jmc/towards/towards.html"> Towards a Mathematical Science of Computation</a>.  It is quite a meaty paper and was certainly a lot to digest.  Here are some highlights that I gleaned from it.</p>
<h3>How can a Mathematical Science of Computation help in a practical way?</h3>
<p>McCarthy points out that while it is hard to predict practical applications ahead of time.  A couple of could be</p>
<ul>
<li>Provide a systematic way to create of programming language.  Rather than just arguing and arbitrarily adding language features whilly nilly.
<li>&#8220;It should be possible to eliminate debugging.  Debugging is the testing of a program on cases one hopes are typical, until it seems to work.  This frequently is in vain.&#8221;
</ul>
<p>This last point of being able to eliminate debugging really stuck with me.  Even with the best of TDD and test suites, we as developers still struggle with the testing of programs against what we hope is &#8220;typical&#8221;.  Over the past years we have improved our techniques and made our programs more robust, but it would certainly be nice to be able to prove a program correct.</p>
<p>If fear that even if this was possible, it would not be enough. At least in my experience, a considerable amount of debugging happens at the human level:</p>
<ul>
<li>The translation of understanding of what the human product owner wants to what the software developer can understand.
<li> The human product owner&#8217;s understanding of what they want in the first place.
</ul>
<p>In my experience, we have just as much trouble (or even more) stating the problem for the program as we do in attempting to solve and prove that it works.</p>
<h3> What we already know that can be applied to a Mathematical Science of Computation </h3>
<ul>
<li>The existence of Turing&#8217;s Universal computers
<li>The existence of classes of unsolvable problems
</ul>
<h3>Perhaps a sonic screwdriver will help?</h3>
<p>McCarthy then goes on to add another tool to the Mathematical Science of computation toolbox. He shows that conditional expressions can be defined recursively.  Then he expands this to relate to programs/computers that can be defined recursively.</p>
<h3>Can a man make a computer program that is as intelligent as him?</h3>
<p>Here is the real question.  McCarthy has us consider the following problem of whether a program on a computers with unlimited memory will ever stop:</p>
<p>A procedure does the following</p>
<ol>
<li>If the number is in a <a href="http://en.wikipedia.org/wiki/Creative_and_productive_sets" title="http://en.wikipedia.org/wiki/Creative_and_productive_sets">creative set</a> then return -> yes.<br />
If a number is not in a creative set then return -> no<br />
or it may run indefinitely</p>
<li>There is no procedure while will always return -> yes when the answer is yes.  and return -> no when the answer is no
</ol>
<p>It is a bit depressing that we can&#8217;t figure out which ones that are really no and which ones run forever.  But don&#8217;t give up.  We can just try to do the best we can.  <a href="http://en.wikipedia.org/wiki/Emil_Leon_Post" title="http://en.wikipedia.org/wiki/Emil_Leon_Post">Emil Post</a> discovered that whenever we try to do the best we can, one can always improve upon it.  He showed that given any procedure, he could make a new procedure that solved all the previous cases plus some new ones. McCarthy pointed out that this process, even though it is really like trying to count the biggest ordinal number, can be mechanized.  So really there is no reason why a machine could not continually improve its own program.</p>
<p>In summary, McCarthy&#8217;s own words are the best:</p>
<blockquote><p>&#8220;In conclusion, let me re-assert that the question of whether there are limitations in principle of what problems man can make machines solve for him as compared to his own ability to solve problems, really is a technical question in recursive function theory.&#8221;</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://gigasquidsoftware.com/wordpress/?feed=rss2&#038;p=504</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
