src/runtime/party/party.c
static value_t intersection_as_closure(pony_ctx_t** ctx,
                                       pony_type_t** runtimeType,
                                       value_t args[],
                                       __attribute__ ((unused)) void* env)
{
  assert(env == NULL);

  // Initially we got two ParT which were merged into one.
  // Unmerge the ParT and perform their intersection
  par_t *p = args[0].p;
  par_t *left = party_get_parleft(p);
  par_t *right = party_get_parright(p);
  closure_t *cmp = args[1].p;
  pony_type_t *type = runtimeType[0];

  // 1. convert right to Set
  // 2. convert left to Set
  // 3. intersection
  set_s *sl = party_to_set(ctx, left, cmp, type);
  set_s *sr = party_to_set(ctx, right, cmp, type);
  set_s *result = party_set_intersection(ctx, sl, sr);
  return (value_t){.p = party_set_to_party(ctx, result, type) };
}
// OPTIMISATION: it should be done in parallel. Spawn task inside.
// OPTIMISATION: It would be great to have a SetPar struture and perform
//               a transformation from ParT to SetParT, HashParT, etc
it should be done in parallel. Spawn task inside.
OPTIMISATION: It would be great to have a SetPar struture and perform
a transformation from ParT to SetParT, HashParT, etc
it should be done in parallel . Spawn task inside . OPTIMISATION : It would be great to have a SetPar struture and perform a transformation from ParT to SetParT HashParT etc
static value_t intersection_as_closure(pony_ctx_t** ctx,
                                       pony_type_t** runtimeType,
                                       value_t args[],
                                       __attribute__ ((unused)) void* env)
{
  assert(env == NULL);
  par_t *p = args[0].p;
  par_t *left = party_get_parleft(p);
  par_t *right = party_get_parright(p);
  closure_t *cmp = args[1].p;
  pony_type_t *type = runtimeType[0];
  set_s *sl = party_to_set(ctx, left, cmp, type);
  set_s *sr = party_to_set(ctx, right, cmp, type);
  set_s *result = party_set_intersection(ctx, sl, sr);
  return (value_t){.p = party_set_to_party(ctx, result, type) };
}
static value_t intersection_as_closure ( pony_ctx_t * * ctx , pony_type_t * * runtimeType , value_t args [ ] , __attribute__ ( ( unused ) ) void * env ) { assert ( env == NULL ) ; par_t * p = args [ 0 ] . p ; par_t * left = party_get_parleft ( p ) ; par_t * right = party_get_parright ( p ) ; closure_t * cmp = args [ 1 ] . p ; pony_type_t * type = runtimeType [ 0 ] ; set_s * sl = party_to_set ( ctx , left , cmp , type ) ; set_s * sr = party_to_set ( ctx , right , cmp , type ) ; set_s * result = party_set_intersection ( ctx , sl , sr ) ; return ( value_t ) { . p = party_set_to_party ( ctx , result , type ) } ; }
OPTIMISATION: it should be done in parallel.
OPTIMISATION : it should be done in parallel .
// Initially we got two ParT which were merged into one. // Unmerge the ParT and perform their intersection // 1. convert right to Set // 2. convert left to Set // 3. intersection