Weighted boolean Lassi Kortela (05 May 2020 13:39 UTC)
(missing)
Weighted alphabets Lassi Kortela (05 May 2020 13:47 UTC)
Re: Weighted boolean Marc Nieper-Wißkirchen (05 May 2020 13:49 UTC)
Re: Weighted boolean John Cowan (05 May 2020 15:09 UTC)
Re: Weighted boolean Bradley Lucier (05 May 2020 19:27 UTC)
Re: Weighted boolean John Cowan (05 May 2020 21:15 UTC)

Weighted alphabets Lassi Kortela 05 May 2020 13:47 UTC

>> Should `make-random-boolean-generator` take an optional argument giving the probability with which #t is returned?
>>
>> For the string and char generators you can do the weighting yourself by giving some characters multiple times, but for booleans I don't see an equally easy way to roll your own weighting.

>> Good idea.

In fact, a Huffman tree and other things can be built out of a (symbol .
frequency) mapping. It could be worthwhile to think of a good Scheme
representation for such a mapping. We could use it in this SRFI as well
as in any other Scheme libraries dealing with alphabets and frequencies.

Booleans would fall out as a special case:

((#t . 7) (#f . 3))  ; returns true 70% of the time