Collection Permutations/Combinations code?
Ned Konz
ned at bike-nomad.com
Fri May 23 03:57:08 UTC 2003
On Thursday 22 May 2003 08:30 pm, Joshua 'Schwa' Gargus wrote:
> Does anyone have code that does something like:
>
> aCollection choose: 3 do: [:array | ...]
>
> where each possible unordered collection of 3 elements (ie:
> "n-choose-k", where n is the size of aCollection and k is here 3)
> is chosen from aCollection and passed as the argument to the block?
You mean like
SequenceableCollection>>combinations:atATimeDo:
there's also permutationsDo:
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|