ciren / cilib

Typesafe, purely functional Computational Intelligence
https://cilib.net
Apache License 2.0
124 stars 101 forks source link

Relax restriction #292

Closed gpampara closed 6 years ago

gpampara commented 6 years ago

The choices and sample functions currently take in NonEmptyList, and result in RVar[Option[List]] as the final result. Because the number of items to sample is provided as a positive integer, the number may be larger or smaller than the input structure (the result is a List).

Some uses have appeared where the user has a List structure and not a NonEmptyList - base don the internal operation of the function, this will not be problematic so a nicer alternative is to allow all Foldable structures. Both NonEmptyList and List fulfil this constraint and are now usable with the function.