I think Henrique Lopes Cardoso wrote:
> 
> (defrule r1
>         ?x <- (foo)
>     =>
>         (bind ?string (implode$ ?x))   ;; IS THERE A WAY OF DOING THIS?

?x is a jess.Fact object. You can call any of the methods of jess.Fact
on it -- including toString() and toStringWithParens(), one of which
surely does what you want.

But I think you need to step back a little and look at your design; in
particular, the way in which you're structuring your data. For
example, why is it important that the "foo" part of

(foo a b c)

be including in your string -- since, given the "foo" pattern, it's
already known? Why not just

...
  ?x <- (foo $?data)
  =>
  (bind ?string (implode $?data))
...

Now, you say that "?string" is just going to be passed to a
Userfunction implemented in Java. Why not just pass "?data" to that
Userfunction (or ?x, if that's what you really want?) Why this
preprocessing step?

Any time you feel like you're fighting Jess (or any tool) to achieve a
certain effect, ask yourself if the problem isn't just that the tool
is designed to make it easy to do things some other way, and consider
if that other way would work for you.

---------------------------------------------------------
Ernest Friedman-Hill  
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to