MSeq and MRand documentation: give an example.

Suggested-by: Dai Weituo
This commit is contained in:
Gabriel Scherer 2024-02-08 15:47:35 +01:00
parent 44d184b6d4
commit 1f2bf2bb13
2 changed files with 24 additions and 0 deletions

View File

@ -1 +1,13 @@
include Utils.MonadPlus
(**
We demand that [MRand.run e] returns an infinite sequence of solutions
sampled from [e], for example
{[
(let open MRand in sum [return 1; return 2; return 3])
|> MRand.run (* infinite stream of random samples *)
|> Seq.take 10 (* take the first 10 elements *)
|> List.of_seq
]}
could be the list [[1; 2; 1; 2; 1; 1; 1; 3; 3; 2]].
*)

View File

@ -1 +1,13 @@
include Utils.MonadPlus
(**
We demand that [MSeq.run e] returns the finite list of solutions
for [e], for example
{[
(let open MSeq in sum [return 1; return 2; return 3])
|> MSeq.run (* list of all solutions *)
|> List.of_seq
]}
should be the list [[1; 2; 3]] -- or maybe the same elements in
some other order.
*)