when
   Map( this["type"] == "Point", $x : this["x"] )
   Map( this["type"] == "Circle", x == $x )
then
end
 

2009/8/19 André Thieme <address.good.until.2009.dec.14@justmail.de>
Edson Tirelli schrieb:

>         when
>                Customer( $custId : id )
>                DailyOrders( count[$custId] == 1 )
>         then

Btw, this brings me to a new syntax question for the default Drools rule
syntax. Is this possible:

when
  m:Map()
  eval( m.get("type") == "Point", $x : m.get("x") )
  ...
  Circle( x == $x )
then
  ...


or, an alternative which may be clearer:

when
  m:Map()
  eval( m.get("type") == "Point" )
  $x : m.get("x")
  ...
then
  ...

So, what I would like to have is:
1) looking at all Maps which have the value "Point" under the key "type"
2) of all those Maps: store in a var what value they have under key "x"
3) reuse the var, here $x instead of having an expensive lookup over and
   over again.

Is that possible? Or would I have to write my example above as
...
c:Circle()
eval(c.getX() == m.get("x"))


André
--
Lisp is not dead. It’s just the URL that has changed:
http://clojure.org/
_______________________________________________



--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com