【发布时间】:2016-09-16 15:47:08
【问题描述】:
我想使用以下 sn-p 在 Pharo 中生成组合:
| col |
col := Set new.
(0 to: 7) asArray
combinations: 5
atATimeDo: [ : combination | col add: combination ].
^ col
我不知道我做错了什么,但总是导致同一个集合的重复:
"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))"
可能是什么问题?
【问题讨论】:
标签: collections combinations smalltalk pharo