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.