Clauses that Build a List of Results

Since we can construct pattern matches that generate multiple binding lists, it's natural to want to use these pattern match expressions with clauses that can generate multiple results. The AssertList object provides a way to do this.

An AssertList clause will build the right hand side of the clause for each pattern match generated by the left-hand side of the clause. If more than one pattern match generates a result, then the results will be wrapped in a List object. Here’s a simple example – the clause:

The left hand side generates four pattern matches and the “b” term of each becomes a term in the List that is returned as the result.