You already have 2 accumulate functions to do what you need:
This is possible with an accumulate where you code the init/action/result explicily. Perhaps not fully "out of the box" but a box that holds everything would be rather big, wouldn't it? ;-)
-W
2011/11/15 Bruno Freudensprung <bruno.freudensprung@temis.com>_______________________________________________Hi all,
There is something I can't express using "collect" or "accumulate" and I would like to have your opinion.
Let's imagine I have the following types :
# a country type
declare Country
name : String
end
# a city type holding a reference to its country
declare City
name : String
country : Country
end
Let's imagine I have all Country and City objects into the working memory.
I want to get the set of Countries corresponding to Cities whose name starts with "X".
I have the impression that I need a kind of (nonexistent right?) "collect" syntax that would look like the "accumulate" syntax (a kind of "anonymous" accumulate function):
# meaning I want to collect $country objects and not City objects
$countries : HashSet() from collect (City($name matches "X.*", $country : country), $country)
Or a home made accumulate function that builds a set of countries:
# custom "buildset" accumulate function
$countries : HashSet() from accumulate (City($name matches "X.*", $country : country), buildset($country))
Do you see any other (possibly out of the box) solution?
Many thanks in advance for your answers,
Best regards,
Bruno.
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users