<div dir="ltr">Sorry off topic, but Forward Production Rete Rules Engines, such fond memories.   An exact blueprint to code one from scratch is below.  Jess is license encumbered, Drools is not, but I expect you&#39;ve already run across it.<div>
<br></div><div>And many, many moons long gone, I did an impl in SML that compiled under MLton  which was PDQ.  Then a buddy of mine with some assistance did what is AFAIK still the only mult-threaded / concurrent implementation (in Java) of a Reta alpha/beta network using a sort of &quot;zipper&quot; algo on the network graph.  It&#39;s still out there <a href="http://www.zilonis.org/">http://www.zilonis.org/</a> , not used by anyone AFAIK, though we believe a few folks did take the code internally.   We had it in production for awhile long ago (ad targeting on web).   Rumor was Forgy also built a concurrent solution, but you had to model the Rete in a DSL and it compiled to Java code.  Never caught on.</div>
<div><br></div><div>Oh and yes of course, the Zilonis version has a &quot;tiny&quot; scheme interpreter built in to write capable of simple calculations, regex matches etc in the rules.<br><div><h2 id="Publications-ProductionMatchingforLargeLearningSystemsReteULbyRobertBDoorenbosPhDthesisCarnegieMellonUniversityJanuary311995" style="font-weight:normal;margin:30px 0px 10px 10px;font-size:1.1em;padding:5px 0px 5px 8px;background-image:url(http://media.codehaus.org/themes/standard-green-experimental/img/gradient2.png);background-color:rgb(238,238,238);border-width:1px;border-style:solid;border-color:rgb(221,221,221) rgb(187,187,187) rgb(187,187,187) rgb(221,221,221);font-family:tahoma,verdana,sans-serif;background-repeat:repeat no-repeat">
<a href="http://docs.codehaus.org/download/attachments/8082/CMU-CS-95-113.pdf?version=1&amp;modificationDate=1092858118000" style="text-decoration:none;color:rgb(34,102,204)">Production Matching for Large Learning Systems (Rete/UL)</a> <br class="">
<br>by Robert B. Doorenbos </h2></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 9, 2013 at 8:36 AM, Grant Rettke <span dir="ltr">&lt;<a href="mailto:grettke@acm.org" target="_blank">grettke@acm.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div><br></div><div>I have the goal of inserting some Jess (<a href="http://herzberg.ca.sandia.gov/" target="_blank">http://herzberg.ca.sandia.gov/</a>) code inside of a Scribble interaction environment (eventually I will have a language to evaluate this but I&#39;m not there yet). Here is the relevant part of the code I have to do that:</div>

<div><br></div><div><div>#lang racket</div><div><br></div><div>(define (my-read-syntax src in)</div><div>  (define path-ls (get-path in))</div><div>  (define path (list-&gt;string path-ls))</div><div>  (define fis (open-input-file #:mode &#39;text path))</div>

<div>  (define datums (let loop ()</div><div>                   (let* ((datum (read fis)))</div><div>                     (cond ((eof-object? datum) empty)</div><div>                           (else (cons datum (loop)))))))</div>

<div>  (close-input-port fis)</div><div>  (datum-&gt;syntax #f datums))</div><div><br></div><div>This does load the file and insert it into Scribble eg:</div><div><br></div><div><div>(interaction</div><div>    #:eval</div>

<div>    my-evaluator</div><div>    ((watch all)</div><div>     (reset)</div><div>     (defrule do-anything &quot;A rule for anything.&quot; ?ne &lt;- (anything) =&gt; (printout t &quot;Someone did something.&quot;) (retract ?ne))</div>

<div>     (assert (anything))</div><div>     (run)))))</div></div><div><br></div><div>There are two things I&#39;m still not doing correctly though:</div><div><br></div><div>#1. I&#39;ve collected the contents of that file into a list of datums that looks like this in DrRacket&#39;s console:</div>

<div><br></div><div><div>&#39;((watch all)</div><div>  (reset)</div><div>  (defrule</div><div>   do-anything</div><div>   &quot;A rule for anything.&quot;</div><div>   ?ne</div><div>   &lt;-</div><div>   (anything)</div>
<div>
   =&gt;</div><div>   (printout t &quot;Someone did something.&quot;)</div><div>   (retract ?ne))</div><div>  (assert (anything))</div><div>  (run))</div></div><div><br></div><div>I don&#39;t want those inserted as a list though, I only want the contents inserted. Up above I see why it is happening, but I am not successfully splicing it in my attempts. What is the right way?</div>

<div><br></div><div>#2. The code body is formatted at least in the output in DrRacket. When it is inserted into the Scribble environment, though, it loses some of it&#39;s formatting namely the defrule and right arrow appear in the same line. That said, when Scribble renders it, all of the code is rendered on the same line like this:</div>

<div><br></div><div><table cellspacing="0"><tbody><tr><td><span>&gt; </span><span>(</span><span>(</span><span>watch</span><span>all</span><span>)</span><span>(</span><span>reset</span><span>)</span><span>(</span><span>defrule</span><span>do-anything</span><span>&quot;A rule for anything.&quot;</span><span>?ne</span><span>&lt;-</span><span>(</span><span>anything</span><span>)</span><span>=&gt;</span><span>(</span><span>printout</span><span>t</span><span>&quot;Someone did something.&quot;</span><span>)</span><span>(</span><span>retract</span><span>?ne</span><span>)</span><span>)</span><span>(</span><span>assert</span><span>(</span><span>anything</span><span>)</span><span>)</span><span>(</span><span>run</span><span>)</span><span>)</span></td>

</tr><tr><td><p><span>=&gt;: arrow not allowed as an expression</span></p><p>How may I read in that file and then generated a syntax object that retains the indentation and new lines?</p><p>#3. Am I generally going about this in an OK manner? My next part of the plan to make a simple language whose only purpose in life is to evaluate Jess code and print out the results; I want to be able to use Scribble for any other Lispy language out there at least the interaction environment.</p>

</td></tr></tbody></table></div>
</div>
<br>____________________<br>
  Racket Users list:<br>
  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>