ecl-logo Documentation

RiffleAlternatives

RiffleAlternatives[trueList,falseList,boolList]combinedList

combines the elements of trueList with falseList by mapping over boolList and selecting the next element from the trueList for a True Bool or from falseList for a False Bool.

Details

    Input
    Output
    Messages
  • IncorrectBoolCountsThe length of the first list has to equal to the number of True instances in the last list, while the length of the second list has to equal to the number of False instances in the last list.
    MismatchedListLengthThe combined length of the first two input lists must match the length of the last input list.

Examples

Basic Examples  (3)

Combines the first two lists based on the last list:

An all True/False Bool list will return the appropriate input list:

Alternating True/False will produce the same result as Riffle:

Messages  (3)

IncorrectBoolCounts  (2)

The length of the first list has to equal to the number of True instances in the last list:

The length of the second list has to equal to the number of False instances in the last list:

MismatchedListLength  (1)

The combine length of the first two input lists has to equal the length of the last list: