Functional programming expresses computation through mathematical functions: every input and output is explicit, and repeated calls with the same input produce the same result. Hidden inputs include internal or external state; hidden outputs include side effects and exceptions. section 6.3 section 6.6
The practical goal is to separate business logic from side effects. Functional architecture concentrates decisions in a functional core and moves state changes and external interactions into a mutable shell. section 6.6
Use these distinctions when evaluating a function:
- An explicit function such as CalculateDiscount receives products and returns a discount without hidden inputs or outputs. section 6.3
- Increment(int x) is predictable because its result depends on the explicit argument; an Increment() method that changes internal x is not. section 6.3
- AddComment exposes text and a Comment result but also mutates _comments, making that mutation a hidden output. section 6.3
public decimal CalculateDiscount(Product[] products)
{
decimal discount = products.Length * 0.01m;
return Math.Min(discount, 0.2m);
}
Inspect CalculateDiscount as a compact example of explicit inputs, an explicit return value, and deterministic calculation. section 6.3


















