Jess Miscellaneous Functions

List of miscellaneous functions that can be executed by Jess.


8.18. (bag <bag-command> <bag-arguments>+)

Package:
BagFunctions
Arguments:
An atom (a sub-command) and one or more additional arguments
Returns:
(Varies)
Description:
The bag command lets you manipulate Java hashtables from Jess. The net result is that you can create any number of associative arrays or property lists. Each such array or list has a name by which it can be looked up. The lists can contain other lists as properties, or any other Jess data type.

The bag command does different things based on its first argument. It's really seven commands in one:

8.20. (bind <variable> <expression>*)

Package:
Intrinsics
Arguments:
A variable name and any value
Returns:
(Varies)
Description:
Binds a variable to a new value. Assigns the given value to the given variable, creating the variable if necessary. Returns the given value.

8.30. (clear-storage)

Package:
Intrinsics
Arguments:
None
Returns:
TRUE
Description:
Clears the hashtable used by (store) and (fetch).

8.55. (fetch <string or atom>)

Package:
Intrinsics
Arguments:
One string or atom
Returns:
(varies)
Description:
Retrieves and returns any value previously stored by the store function under the given name, or nil if there is none. Analogous to the fetch() member function of the Rete class. See the section on using store and fetch for details.

8.61. (gensym*)

Package:
Intrinsics
Arguments:
None
Returns:
Atom
Description:
Returns a special unique sequenced value. Returns a unique atom which consists of the letters gen plus an integer. Use setgen to set the value of the integer to be used by the next gensym call.

8.75. (jess-version-number)

Package:
Intrinsics
Arguments:
None
Returns:
Float
Description:
Returns a version number for Jess; currently 6.0 .

8.76. (jess-version-string)

Package:
Intrinsics
Arguments:
None
Returns:
String
Description:
Returns a human-readable string descriptive of this version of Jess.

8.126. (set-factory [factory object] )

Package:
MiscFunctions
Arguments:
External address, an object that implements the interface jess.factory.Factory
Returns:
External address, an object that implements the interface jess.factory.Factory; the previous value of this property.
Description:
Set the "thing factory" for the active Rete object. Providing an alternate "thing factory" is a very advanced, and currently undocumented, way to extend Jess's functionality.

8.133. (setgen <numeric-expression>)

Package:
MiscFunctions
Arguments:
A numeric expression
Returns:
TRUE
Description:
Sets the starting number used by gensym*. Note that if this number has already been used, gensym* uses the next larger number that has not been used.

8.139. (store <string or atom> <expression>)

Package:
Intrinsics
Arguments:
A string or atom and any other value
Returns:
(varies)
Description:
Associates the expression with the name given by the first argument, such that later calls to the fetch will retrieve it. Storing the atom nil will clear any value associated with name. Analagous to the store() member function of the jess.Rete class. See section on using store and fetch for more details.

8.150. (system <lexeme-expression>+ [&])

Package:
MiscFunctions
Arguments:
One or more atoms or strings
Returns:
a java.lang.Process object, or FALSE
Description:
Sends a command to the operating system. Each atom or string becomes one element of the argument array in a call to the Java java.lang.Runtime.exec(String[] cmdaray) method; therefore to execute the command edit myfile.txt, you should call (system edit myfile.txt), not (system "edit myfile.txt").

Normally blocks (i.e., Jess stops until the applet returns), but if the last argument is an ampersand (&), the program will run in the background. The standard output and standard error streams of the process are connected to the 't' router, but the input of the process is not connected to the terminal.

Returns the Java Process object. You can call waitFor and then exitValue to get the exit status of the process.

8.152. (time)

Package:
MiscFunctions
Arguments:
None
Returns:
Number
Description:
Returns the number of seconds since 12:00 AM, Jan 1, 1970.