             if let funcName = subfunction.name {
                 finalContext = extendContext(context: finalContext, name: funcName, value: closure)
             }
-            return body.evaluate(context: finalContext)
+            return subfunction.body.evaluate(context: finalContext)
         default:
             return .error("closure does not wrap function")
         }

            case "|":
                return try evaluateLogical(arguments: arguments, context: context) { a, b in a || b }
            default:
                return .error("cannot evaluate call '\(name)' with arguments \(arguments)")
            }
        } catch let EvaluationError.notANumber(x) {
            return .error("\(x) is not a number")
        } catch let EvaluationError.notABoolean(x) {
            return .error("\(x) is not a boolean")
        } catch {
            preconditionFailure("internal error: \(error)")
        }

            return .error("requires pair")
        }
    }

    private func evaluateUserFunction(name: String, arguments: [Expression], context: Context) throws -> Expression {
        guard let expr = context[name] else {
            return .error("cannot evaluate call '\(name)' with arguments \(arguments)")
        }
        guard case let .closure(closureFunction, closureContext) = expr else { throw EvaluationError.notAFunction(expr) }
        guard case let .subfunction(subfunction) = closureFunction else { throw EvaluationError.notAFunction(closureFunction) }
        let body = subfunction.body
        return body.evaluate(context: context)
    }
}
