[ANN] CLIPSExamples 1.0 - a RevCLIPS demo app

Alex Rice alex at mindlube.com
Fri Dec 26 02:25:42 CST 2003

On Dec 25, 2003, at 3:55 PM, Mark Brownell wrote:
> Kool; COOL
> Can't wait to see your source code for this CLIPSExamples 1.0.

There are some short docs in the 07-09-03 version of revclips you can 
start with. There are some minor changes to the API that will be 
upcoming in the next revclips version, that are mentioned on the 
revclips web page.

Basically all the CLIPSExamples app does is load clips source code from 
files on disk, and runs CLIPS on it. The input and output is redirected 
to go into the GUI app instead of a console app. So the essence of the 
app is just this single handler. The error handling and selecting of 
source code file to run is omitted just for emphasis:

on startSystem
   clipsLoad "examples/something.clp"
   get clipsRun(-1)
end startSystem

So there is actually not much to CLIPSExamples; and if you want to 
start right away learning CLIPS open up the .clp files in the examples/ 
directory. They are the text (source) for the programs in the popup 
menu there in CLIPSExamples.

Also download the main CLIPS distribution to use the interactive shell 
for experimenting and learning.

> Thanks for the introduction to CLIPS and your hard work.

You're welcome. I think CLIPS is great & I'm glad to be able to bring 
it to new users.

I learned CLIPS for a project for my day job with Architectural 
Research Consultants Inc. It's a "facility calculator" for estimating 
spaces and costs for large construction and development projects. It is 
a really difficult programming challenge and I originally trying to do 
it with normal procedural code, in Realbasic. It would have been just 
as hard in C++, in Java, Perl, etc. I was trying to solve it 
procedurally and that was the problem. Luckily I had taken some machine 
learning and cognitive psych. classes in college and it occurred to me 
it really is an expert system I was programming. After all the 
architects and planners were telling me who to encode into the software 
rules. So I searched, found and learned CLIPS and it really saved my 

But also realized rule-based programming is just really *neat* and not 
only for expert systems. Anywhere you have a many-to-many pattern 
matching problems, it's perfect. Or AI, or agent-based systems. 
Possibly even neural networks and other connectivist and more 
math-related stuff. I have some ideas for using CLIPS as the engine for 
puzzle and action games written in Rev.

You can work with just "facts" and "rules" if you want. That's what I 
did for the facility calculator. But CLIPS also has procedural 
programming (functions, loops, switches, if-thens, etc). It has generic 
functions. It has object oriented programming. It has "instance set 
queries and distributed actions" which I've never seen in another 
programming language. So is has all these powerful aspects, and one can 
use any or all of them together.

>  This looks like something I could get into. I can't wait to get into 
> expert systems with the AI capacity of CLIPS & Roulette patterns among 
> groups of numbers occurring during multi-numbered events like 300 
> spins per full-event-cycle. I was going to write my own 80%, 85%, 95% 
> & 100% if/then based system for checking patterns using Transcript for 
> the rule based checking.

I don't know roulette, but gaming/gambling in general would be perfect 
for rule-based systems. The rules of play are, well, rules of course. 
Also to represent the game state, and the heuristics/rules of thumb for 
smart game play, prediction, odds making, all this kind of thing, with 
CLIPS you could write all the aspects to fit together into a working, 
coherent model.

With transcript it would surely be possible, but it would be much 
tougher, even with a 4GL language like transcript.

There are people who scoff at expert systems and say stuff like "oh in 
college I wrote a rule-based expert system in 15 minutes using LISP" 
then know that person is just talking about just a pattern matching 
*algorithm*, not a real working engine and programming language like 
CLIPS. Also, CLIPS in source form is 5.6 MB of well engineered C code. 
That's nothing to sneeze at :-)

> Being new to CLIPS just today I will have to learn from your 
> CLIPSExamples 1.0 source code.

I recommend the Beginning Programmers Guide (bpg.pdf) at 

Also there is a good book in print: _Expert Systems, Principles and 
Programming_ by Giarratano & Riley. It's about half general expert 
systems theory and half CLIPS specifics. Co author is Garey Riley, the 
main CLIPS programmer and is active on the mailing list and web forums.

Anyways- between the BPG and the print book- that's how I learned. The 
Advanced Programming Guide (apg.pdf) describes the C API for embedding 
and extending CLIPS like I did to create revclips.

Alex Rice <alex at mindlube.com> | Mindlube Software | 

what a waste of thumbs that are opposable
to make machines that are disposable  -Ani DiFranco

More information about the use-livecode mailing list