I want to generate combinations in Pharo using the following snippet:
| col | col := Set new. (0 to: 7) asArray combinations: 5 atATimeDo: [ : combination | col add: combination ]. ^ col
I do not know what I am doing wrong, but always leads to repetitions of the same set:
"a Set(#(7 7 7 7 7) #(7 7 7 7 7) #(7 7 7 7 7) #(7 7 7 7 7) #(7 7 7 7 7) #(7 7 7 7 7) #(7 7 7 7 7) #(7 7 7 7 7) #(7 7 7 7 7) #(7 7 7 7 7) #(7 7 7 7 7) #(7 7 7 7 7))"
What could be the problem?
, - , #combinations:atATimeDo: , . , . , , , , , , , . , copy :
#combinations:atATimeDo:
copy
| col | col := Set new. (0 to: 7) asArray combinations: 5 atATimeDo: [ : combination | col add: combination copy ]. ^ col
Source: https://habr.com/ru/post/1654828/More articles:Angular2 - update interface after removal - angularYou must complete two HTTP network requests at the same time (with a completion handler after both are completed) - httpHow to add a new column to an existing view in SQL Server 2014 using Alter - sqlDisplay telephone links in HTL based on input from Rich Text widget - xssIOS source tests not working on CocoaPods SDK Google Maps - iosC # enable / disable console - c #neat method for testing model parameters - rOrganization of a large number of mutations - graphqlJekyll Build Error - ruby | fooobar.comHow to view notifications during testing? - phpAll Articles