jliszka / probability-monad

Apache License 2.0
263 stars 38 forks source link

Make Distribution.get public #26

Closed fdietze closed 2 years ago

fdietze commented 2 years ago

This allows to avoid List creation using sample if only one sample is needed. Does it have any downsides to use get directly?

Or would it be better to provide an extra method like singleSample or similar?

jliszka commented 2 years ago

Yeah it's somewhat intentional... to force people to use monadic operations (map/filter/flatMap) and stay "in" the monad as long as possible, rather than writing their own loops where they draw samples and aggregate. In that case I think singleSample would be fine.

fdietze commented 2 years ago

@jliszka It's ready to merge.