|
|
|
Re: [ATL]Problem with toSequence operator [message #52280 is a reply to message #52254] |
Thu, 12 July 2007 10:32   |
Eclipse User |
|
|
|
Hello,
Something like this should work:
helper context String def: toSequence() : Sequence(String) =
let size : Integer = self.size() in
if self.size() > 1 then
Sequence {self.substring(1, size - 1).toSequence(),
self.substring(size, size)->asSequence()}->flatten()
else if self.size() = 1 then
Sequence {self}
else
Sequence {}
endif endif;
Regards,
Frédéric Jouault
Bea wrote:
> I have install ATL in Eclipse 3.2 according with the page
> http://wiki.eclipse.org/index.php/ATL/How_Install_ATL_From_C VS/
>
> In other versions of ATL, it worked but I have problems with this version.
> has anybody tried to obtain the same result using recursion?
> Thank you
>
>
> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> escribió en el mensaje
> news:f75ap2$o4i$1@build.eclipse.org...
>> Hello,
>>
>> I have tried 'hello'.toSequence() on the latest version of ATL, and on the
>> (older) version available on the AMMA homepage:
>> http://www.sciences.univ-nantes.fr/lina/atl/atldemo/oclonlin e/?query=%27hello%27.toSequence%28%29
>>
>> It worked in both cases.
>>
>> Could you please try with another version of ATL (e.g., the latest),
>> and/or send us more information about the issue (e.g., the complete stack
>> trace)?
>>
>> Thanks.
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Bea wrote:
>>> Hello,
>>> I am trying to convert a string into a Sequence. I use the toSequence
>>> operator (varSequence = varString.toSequence()), but I get the
>>> java.lang.NullPointerException. I have also tried with
>>> 'hello'.toSequence() and I get the same error.
>>> I have seen the post
>>> http://www.sciences.univ-nantes.fr/lina/atl/www/atl_discussi on_archive/0695.html
>>> but I don't know how to use recursion in ATL without a collection.
>>> can anybody help my?
>>> Thank you in advance.
>>>
>>>
>>>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.05528 seconds