• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Jess and LISP

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic