uqbar-project / wollok

Wollok Programming Language
GNU General Public License v3.0
60 stars 16 forks source link

Add unique method to lists #983

Closed flbulgarelli closed 7 years ago

flbulgarelli commented 8 years ago

I have already see asSet().asList() idiom in many students solutions. So we need a method for removing duplicates in lists, without converting them into sets. It could be as simple as:

method unique() = asSet().asList()

It could be a method with or without effects, it is not so important for me. An effectful method could be named removeDuplicates or something like that.

npasserini commented 8 years ago

I do not like the name unique.

removeDuplicates sounds ok for an effectful methods or #withoutDuplicates

could work for a pure one.

On Thu, Sep 15, 2016 at 12:35 AM, Franco Leonardo Bulgarelli < notifications@github.com> wrote:

I have already see asSet().asList() idiom in many students solutions. So we need a method for removing duplicates in lists, without converting them into sets. It could be as simple as:

method unique() = asSet().asList()

It could be a method with or without effects, it is not so important for me. An effectful method could be named removeDuplicates or something like that.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/983, or mute the thread https://github.com/notifications/unsubscribe-auth/AEa1OV0q5HbnY57mB6l8ts2IC03RwgDXks5qqHbNgaJpZM4J9Uc9 .

flbulgarelli commented 8 years ago

Ok, withoutDuplicates sounds good for a pure method!