[ATL] Why returning a sequence of a sequence ? [message #57021] |
Thu, 09 August 2007 10:47  |
Eclipse User |
|
|
|
Hi,
considering these 3 operations on the Set 'totargets' :
totargets.debug('relFromS');
totargets->collect(e|e.target).debug('AOut');
totargets->collect(e|e.target)->collect(e|e.relationShipSources).debug('relToR');
the two first operations print well a sequence for each, but the third
prints a sequence of a sequence 'Sequence {Sequence {IN!<unnamed>,
IN!<unnamed>, IN!<unnamed>}}'. Why this behaviour ?
I must use the operation flatten() to finally get my sequence !
Thanks
Guillaume
|
|
|
|
Re: [ATL] Why returning a sequence of a sequence ? [message #57100 is a reply to message #57074] |
Thu, 09 August 2007 11:58  |
Eclipse User |
|
|
|
Ok, fine !
Thank you for your rapid response
Guillaume
Frédéric Jouault a écrit :
> Hi,
>
> > considering these 3 operations on the Set 'totargets' :
> >
> > totargets.debug('relFromS');
> > totargets->collect(e|e.target).debug('AOut');
> >
> totargets->collect(e|e.target)->collect(e|e.relationShipSources).debug('relToR');
>
> >
> >
> > the two first operations print well a sequence for each, but the third
> > prints a sequence of a sequence 'Sequence {Sequence {IN!<unnamed>,
> > IN!<unnamed>, IN!<unnamed>}}'. Why this behaviour ?
>
> Sometimes you want to get a Sequence of Sequence.
>
>
> > I must use the operation flatten() to finally get my sequence !
>
> Yes.
>
>
> Of course, we could have the "collectNested" iterator that would return
> a Sequence of Sequence. The collect iterator would then consist of
> "collectNested" followed by a call to "flatten".
>
> However, switching for this alternate behavior would break some existing
> transformations relying on the way it currently works.
>
>
> Regards,
>
> Frédéric Jouault
|
|
|
Powered by
FUDForum. Page generated in 0.05925 seconds