         case let .subfunction(subfunction):
 
             var extendedContext = try matchParameters(closureContext: closureContext, callingContext: callingContext, parameters: subfunction.patterns, arguments: arguments)
+            let whenEvaluated = try subfunction.when.evaluate(context: extendedContext)
+            guard case .booleanValue(true) = whenEvaluated else { throw EvaluationError.signatureMismatch }
             if let funcName = subfunction.name {
                 extendedContext = extendContext(context: extendedContext, name: funcName, value: closure, replacing: false)
             }

            let evaluatedValue = try argument.evaluate(context: callingContext)
            extendedContext = extendContext(context: extendedContext, name: name, value: evaluatedValue, replacing: true)
        default:
            throw EvaluationError.parameterArgumentMismatch
        }
        return extendedContext
    }

    case notABoolean(Expression)
    case notAFunction(Expression)
    case symbolNotFound(String)
    case signatureMismatch
}

extension Expression {
