Pattern Calculus: Computing with Functions and Structures