<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>OpenCog Brainwave &#187; Shell</title>
	<atom:link href="http://brainwave.opencog.org/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://brainwave.opencog.org</link>
	<description>The first ultraintelligent machine is the last invention that man need ever make. -I. J. Good, 1965</description>
	<lastBuildDate>Sat, 20 Feb 2010 01:14:01 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='brainwave.opencog.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/a001c33bb7fddefe336a6afdfb4688b6?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>OpenCog Brainwave &#187; Shell</title>
		<link>http://brainwave.opencog.org</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://brainwave.opencog.org/osd.xml" title="OpenCog Brainwave" />
	<atom:link rel='hub' href='http://brainwave.opencog.org/?pushpress=hub'/>
		<item>
		<title>scheme shell</title>
		<link>http://brainwave.opencog.org/2008/05/27/scheme-shell/</link>
		<comments>http://brainwave.opencog.org/2008/05/27/scheme-shell/#comments</comments>
		<pubDate>Tue, 27 May 2008 14:02:44 +0000</pubDate>
		<dc:creator>linasv</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Guile]]></category>
		<category><![CDATA[OpenCog]]></category>
		<category><![CDATA[Scheme]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://opencog.wordpress.com/?p=21</guid>
		<description><![CDATA[I needed the ability to hand-edit opencog data while other processes were running. And so I hacked with guile for a while, and now there&#8217;s a scheme shell for opencog.
So far it&#8217;s very simple: just say &#8217;scm&#8217; at the opencog prompt; this puts you into the shell. Then you can scheme away.
So, fore example:
&#160;&#160;(cog-new-node 'ConceptNode [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brainwave.opencog.org&blog=3423956&post=21&subd=opencog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I needed the ability to hand-edit opencog data while other processes were running. And so I hacked with guile for a while, and now there&#8217;s a scheme shell for opencog.<br />
So far it&#8217;s very simple: just say &#8217;scm&#8217; at the opencog prompt; this puts you into the shell. Then you can scheme away.</p>
<p>So, fore example:</p>
<p>&nbsp;&nbsp;<code>(cog-new-node 'ConceptNode "some node name")</code></p>
<p>creates a new node:</p>
<p>&nbsp;&nbsp;<code>#&lt;node[3:some node name] sti:(0,0) tv:(0.000000,0.000000)&gt;</code></p>
<p>Well&#8230; I suppose the above looks like goobldy-gook. But it just says that its a new node with zero &#8220;short-term importance&#8221; (sti) and zero &#8220;truth value&#8221; (tv). It would be slicker if all this could be viewed visually, as a graph&#8230; the above would be just a single point, with a label.</p>
<p>Creating links is easy:</p>
<p>&nbsp;&nbsp;<code>(define x (cog-new-node 'ConceptNode "abc"))<br />
(define y (cog-new-node 'ConceptNode "def"))<br />
(cog-new-link 'Link x y)</code></p>
<p>which creates two new nodes (called &#8216;x&#8217; and &#8216;y&#8217;) and a link connecting the two. Here&#8217;s the result:</p>
<p>&nbsp;&nbsp;<code>#&lt;link[2 sti:(0,0) tv:(0.000000,0.000000) &lt;[3 abc],[3 def]&gt;]&gt;</code></p>
<p>What&#8217;s slick about scheme is that it&#8217;s easy to add a bit of syntactic sugar to make link and node creation even easier. So, for example, we can define some new functions:</p>
<p>&nbsp;&nbsp;<code>(define (concept x) (cog-new-node 'ConceptNode x))<br />
    (define (pred x)    (cog-new-node 'PredicateNode x))<br />
    (define (listyl x)  (cog-new-link 'ListLink x)) ; list is a reserved word in scheme<br />
    (define (evely x)  (cog-new-link 'EvaluationLink x))  ; eval is a reserved word in scheme</code></p>
<p>and with this syntactic sugar:</p>
<p>&nbsp;&nbsp;<code>(evely  (pred "eats") (listyl (concept "cat") (concept "fish")))</code></p>
<p>which creates the opencog graph:</p>
<p>&nbsp;&nbsp;<code>#&lt;link[53 sti:(0,0) tv:(0.000000,0.000000) &lt;[47 eats],link[13 sti:(0,0) tv:(0.000000,0.000000) &lt;[3 cat],[3 fish]&gt;]&gt;]&gt;</code></p>
<p>So I&#8217;m thrilled. I can finally create, edit and delete nodes on the fly, without having to write C++ code, compile it, etc. etc.  Woo hoo!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/opencog.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/opencog.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opencog.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opencog.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opencog.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opencog.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opencog.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opencog.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opencog.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opencog.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opencog.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opencog.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=brainwave.opencog.org&blog=3423956&post=21&subd=opencog&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://brainwave.opencog.org/2008/05/27/scheme-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a221b4b4e6dd199750731c51ee864a91?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">linasv</media:title>
		</media:content>
	</item>
	</channel>
</rss>