aspose file tools
The moose likes General Computing and the fly likes Jess and LISP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » General Computing
Reply Bookmark "Jess and LISP" Watch "Jess and LISP" New topic
Author

Jess and LISP

Gregg Bolinger
Sheriff

Joined: Jul 11, 2001
Posts: 15040

Ernest,
How is Jess different from LISP? At first glance, it looked a lot like a JAVA version of LISP. But I have not had time to look into Jess very in depth.
Could you set me straight?


My Blog | DZone Articles
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 23395

The Jess rule language syntax is indeed LISP-like. The manual says a "stylized version" of LISP. Simple, functional code looks just like LISP: (+ (* 2 3) 2) evaluates to 8, just as in pretty much every LISP dialect there ever was.

You can write simple LISP programs in Jess and get them to work, although their performance characteristics will be different than in traditional LISP because Jess's "lists" aren't linked lists as in regular LISP, but more array-like, which makes them random-access in constant time, unlike LISP lists which you can only access in O(n) time. Of course, the downside of this is that "growing" a list is more costly in Jess. But given that Jess lets you work easily with Java objects, you could use a java.util.LinkedList object easily from your Jess code if you wanted to.
You can use Jess as a Java scripting language, if you want. You can create Java objects, call their methods, access their member variables, even lock monitors and write multithreaded code. It's actually a nice prototyping tool; you can easily create GUIs by typing a line of code at a time, and dynamically move components around to see the effect -- it's very useful actually.
But in any event, Jess isn't intended as a general-purpose LISP implementation; it's a rule language. It has many constructs (what are called "special forms" in LISP circles) that exist specifically to support writing rules. The rule engine itself -- the pattern-matcher and rule execution engine -- aren't written on top of the LISP-like platform -- they are written in Java, so they're "underneath" the LISP-like layer, and they're fast.
Why does Jess use this language? Some variation on the Jess syntax has a long history in rule-based programming circles, and therefore there's a large base of folks who already know the core of the language. Rules written in the Jess language are actually much clearer and more succinct than equivalent rules written in the more Java-like syntaxes used by some other rule engines, so I've stuck with the "stylized LISP" since Jess's inception.


[Jess in Action][AskingGoodQuestions]
 
 
subject: Jess and LISP
 
Threads others viewed
Jess, about to hit 1000!
to print a page
decent math forum
WA #1.....word association
Einstein's riddle
MyEclipse, The Clear Choice