Allow wchooseCycles probabilities to be patterned (#1292)
* allow wchooseCycles probabilities to be patterned
This commit is contained in:
parent
1f233b9e7d
commit
0925ea56dd
5 changed files with 181 additions and 8 deletions
|
|
@ -1244,6 +1244,16 @@ export function reify(thing) {
|
|||
return pure(thing);
|
||||
}
|
||||
|
||||
/** Takes a list of patterns, and returns a pattern of lists.
|
||||
*/
|
||||
export function sequenceP(pats) {
|
||||
let result = pure([]);
|
||||
for (const pat of pats) {
|
||||
result = result.bind((list) => pat.fmap((v) => list.concat([v])));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** The given items are played at the same time at the same length.
|
||||
*
|
||||
* @return {Pattern}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue