The Jess language2.
来源:互联网 发布:数据库取代表格 编辑:程序博客网 时间:2024/06/09 21:07
Functions
Function calls in Jess are simply lists . Function calls use a prefix notation; a list whose head is an atom that is the name of an existing fuanction can be a function call.
Variables
Programming variables in Jess are atoms that begin with the question mark (?) character. The question mark is part of the variable's name. A variable whose first character is instead a $ (for example , $?X) is a multivariable, which can refer to a special kind of list called a multifield. For example :Jess>(bind ?x "The value") Jess>(bind $?grocery-list (create$ eggs bread milk))
Global variables (or defglobals)
To create global variables that are not destroyed by reset , you can use the defglobal construct.
(defglobal [?<global-name> = <value>]+)
Global valiable names must begin and end with an asterisk(*).
Deffunctions
You can define your own funcions using the deffuncion construct.A deffunction construct looks like this:
(deffunction <function-name> [<doc-comment>] (<parameter>*)
<expr>*
[<return-specifier>])
Jess>(deffunction max(?a ?b)
(if ( > ?a ?b) then
(return ?a)
else
(return ?b)))
Defadvice
Sometimes a Jess Function won't behave exactly as you'd like. The defadvice construct lets you write some Jess code which will be executed before or after each time a geiver Jess function is called.
Jess> (defadvice before + (return 1))
Java reflection
Among the list of functions above are a set that lte you create and manipulate Java objects directly from Jess. Using them ,you can do virtually anything you can dou from Java code , except for defining new classes.
Jess> (bind ?ht (new java.util.Hashtable))
Jess> (call ?ht put "key1" "element1")
Jess> (call ?ht put "key2" "element2")
Jess> (call ?ht get "key1")
Jess> (bind ?pt (new java.awt.Point))
Jess> (set-menber ?pt x 37)
Jess> (set-menber ?pt y 42)
Jess> (get-menber ?pt x)
- The Jess language2.
- The Jess language 1.
- The Jess language 3 .
- The Jess language 4.
- Jess - Notes
- JESS专家系统的妙用
- 专家系统JESS实例教程
- 专家系统JESS实例教程
- JESS专家系统的妙用
- 专家系统JESS实例教程
- JESS专家系统的妙用
- JESS专家系统的妙用
- 专家系统JESS实例教程
- JESS专家系统的妙用
- 专家系统JESS实例教程
- JESS专家系统的妙用
- 专家系统JESS实例教程
- JESS专家系统的妙用
- ASP中使用事务处理
- 提高FastReplace速度 (fStrRep.pas)
- 双精度浮点数的加法计算误差及其避免的初步方法
- [转帖] 登录网站时需注意的一些礼节
- D3DXMatrixLookAtLH 函数
- The Jess language2.
- C#的四个基本技巧
- 开篇语-建立4C标准的电子商务网站
- D3DXMatrixLookAtRH 函数
- 中国农历算法(delphi)
- 我有6个Gmail邀请权,谁要?
- “伯乐”喜欢什么“马”
- Tapestry + Spring + Hibernate 整合工作及相关问题
- D3DXMatrixMultiply 函数