Recursive comparison of expression and pattern.

test_pattern_rec(escape, expr, test_expr, eval_env, match_env)

Arguments

escape

Continuation from callCC, used to escape if we cannot match.

expr

The expression to match again.

test_expr

The pattern we are trying to match.

eval_env

The environment where we get constructors from.

match_env

The environment to put matched variables in.

Value

An environment containing bound variables from the expression, if matching. If the pattern doesn't match, the function escapes through the escape continuation.