BriceG wrote > Hi, > it depends on what is your goal but if you want to clean an > OrderedCollection there's removeAll of if you want to remove specific item > there's removeAllSuchThat:aBlock > > I had the following code working for your example: > > col := #(1 2 3 4 5) asOrderedCollection. > a := col select:[:each| col includes:each]. > col removeAllSuchThat: [ :each| a includes:each ]. > col > > as you suggested, I'm creating a new collection with all the element I > want to remove and then I remove each of its item from the first > collection. > > Regards, > > > > -------------- > Brice Govin > PhD student in RMoD research team at INRIA Lille > Software Engineer at THALES AIR SYSTEMS Rungis > ENSTA-Bretagne ENSI2014 > 64 chemin des boeufs 91220 PALAISEAU > ________________________________ > De : Peter Uhnák [via Smalltalk] <
> ml-node+s1294792n4816822h94@.nabble > > > Envoyé : jeudi 2 avril 2015 08:11 > À : Brice GOVIN > Objet : OrderedCollection remove: > > Hi, > > I've just run into quite a nasty surprise > ~~~~~~~~~~~~~~~~ > col := #(1 2 3 4 5) asOrderedCollection. > col do: [ :each | col remove: each. ]. > col > ~~~~~~~~~~~~~~~~ > it throws "NotFound: nil not found in OrderedCollection" > I tested it also in Pharo3 and there it just silently removed first, third > and fifth element. > > Looking at the implementation of OrderedCollection>>do: it seems that > doing what I'm doing is a bad idea. > > So what shall one do:? col copy do: [...] ? > > Why can't do: be a bit smarter? Optimization? > > Thanks, > Peter > > > ________________________________ > If you reply to this email, your message will be added to the discussion > below: > http://forum.world.st/OrderedCollection-remove-tp4816822.html > To unsubscribe from Pharo Smalltalk Users, click > here<http://forum.world.st/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1310670&code=YnJpY2UuZ292aW5AZW5zdGEtYnJldGFnbmUub3JnfDEzMTA2NzB8MTQ0Nzk1ODcwOA==>. > NAML<http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> ----- Cheers, Sean -- View this message in context: http://forum.world.st/OrderedCollection-remove-tp4816822p4816864.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.