I think BPoon wrote:
>
> Dear users of JESS,
>
> I am a student which have to use JESS for my Project.
> I have to write a knowledge-based component for fraction
> calculation. But I am just a beginner of JESS and also new for
> programming.
I wonder how you've got yourself saddled with such a project, then!
>
> Can anyone help me about the following problems?
> 1) Can i write a function which can convert infix notation of a fraction
> into prefix or postfix notation in JESS so that i can store the
> prefix/postifx string into database?
> Is there any function for stack in JESS? anyone can give me some
> examples on coding on this problem?
Let me preface this with the comment that using Jess to write a "desk
calculator" program (that's what I'm assuming you mean here) is a
really horrid mismatch between capabilities and tasks. Parsing and
evaluating expressions is entirely deterministic -- there's generally
an exact, unambiguous grammar -- and can be easily handled using
classical parsing techniques. Any introductory compiler-writing text
will use parsing simple arithmetic expressions as its first example
program. Using Jess to do this task will be much, much harder. It's
like using a hammer to cut wood.
Anyway, before you can sensibly answer these questions, you have to
define what your data structures will look like. Since Jess doesn't
have a notion of nested lists, you'll have to devise a scheme for
representing expressions as flat ones. Given these data structures,
and given that Jess is a complete programming language, of course such
a function can be written.
There is an example in the examples directory called "stack.clp" that
manipulates stacks of blocks represented as lists.
>
> 2) For storing the data, can i connect the database to JESS program
> directly, or I have to use JAVA program for database management?
Hmm. As hard as it is to imagine why you want to use Jess to do this,
it's even harder to imagine what you're using a database for. But in
any event, the answer is that Jess itself doesn't have database
primitives, but you can call any Java function from Jess, so you can
access your database this way.
>
> 3) if i have more than two fractions, and i will input them to my JESS
> program. how can i read them two by two and do the same operations and
> rules on these two fractions?
>
I have no idea what you're saying here. I suspect the answer will be
very plain once you have defined your data structures.
> Please help me. Thanks in advance
My recommendation is to go talk to your professor about this project,
and see if you can't together devise a more sensible one.
>
> Best Regards,
> BPoon
> [EMAIL PROTECTED]
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------