<div dir="ltr">Great! Thanks!<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 25, 2019 at 8:31 PM Andres Valloud <<a href="mailto:ten@smallinteger.com">ten@smallinteger.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">How about >20% faster in general? I also fixed up comments that <br>
referenced methods and variables that didn't exist, etc.<br>
<br>
I strongly suspect this iteration can be made to run faster still.<br>
<br>
On 5/25/19 11:19, Luciano Notarfrancesco via Cuis-dev wrote:<br>
> Hi Hernan,<br>
> Thanks for integrating! Next time I should provide tests...<br>
> Yes, it is expected behavior, it was made like that in order to <br>
> enumerate combinations as fast as possible without stressing the GC (I <br>
> wonder how much difference does it make nowadays, tho). I thought that <br>
> the name 'atATimeDo' was a remainder that the array is being reused in <br>
> each iteration, but actually groupsOf:atATimeDo: doesn't reuse the <br>
> array, and permutationsDo: reuses the array. IMHO groupsOf:do: and <br>
> combinationsOf:do: would be nicer names, but not a big deal.<br>
> <br>
> <br>
> On Sat, May 25, 2019 at 1:06 PM Hernan Wilkinson <br>
> <<a href="mailto:hernan.wilkinson@10pines.com" target="_blank">hernan.wilkinson@10pines.com</a> <mailto:<a href="mailto:hernan.wilkinson@10pines.com" target="_blank">hernan.wilkinson@10pines.com</a>>> wrote:<br>
> <br>
> Hi Luciano,<br>
> thank you for the fix. It is integrated now and I added a couple<br>
> of tests to SequenceableCollectionTest, one when k is cero and<br>
> another for the normal case.<br>
> <br>
> When I wrote the test for the normal case I notice that the<br>
> collection passed as parameter to the block it is always the name<br>
> and therefore the following test fails:<br>
> testCombinationsAtATimeDoWorksAsExpected<br>
> <br>
> | combinations |<br>
> <br>
> combinations := OrderedCollection new.<br>
> 'abc' combinations: 2 atATimeDo: [ :combination | combinations add:<br>
> combination].<br>
> <br>
> self assert: 3 equals: combinations size.<br>
> self assert: (combinations includes: #($a $b)).<br>
> self assert: (combinations includes: #($a $c)).<br>
> self assert: (combinations includes: #($b $c)).<br>
> <br>
> To make it pass I had to make a copy of combination.<br>
> ...<br>
> 'abc' combinations: 2 atATimeDo: [ :combination | combinations add:<br>
> combination *copy*].<br>
> ....<br>
> <br>
> Is that the expected behavior? It looks weird to me... I would<br>
> expect combination to be different collections on each iteration...<br>
> <br>
> Cheers!<br>
> Hernan.<br>
> <br>
> On Thu, May 23, 2019 at 1:13 PM Luciano Notarfrancesco via Cuis-dev<br>
> <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a> <mailto:<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>>> wrote:<br>
> <br>
> The method was failing for the corner case of "combinations of 0<br>
> elements". Here's the fix.<br>
> -- <br>
> Cuis-dev mailing list<br>
> <a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a> <mailto:<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a>><br>
> <a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
> <br>
> <br>
> <br>
> -- <br>
> *Hernán Wilkinson<br>
> Agile Software Development, Teaching & Coaching*<br>
> *Phone: +54-011*-4893-2057<br>
> *Twitter: @HernanWilkinson*<br>
> *site: <a href="http://www.10Pines.com" rel="noreferrer" target="_blank">http://www.10Pines.com</a> <<a href="http://www.10pines.com/" rel="noreferrer" target="_blank">http://www.10pines.com/</a>>*<br>
> Address: Alem 896, Floor 6, Buenos Aires, Argentina<br>
> <br>
> <br>
</blockquote></div>