Tag functions

First Class Functions and Functional Programming

Functions can take other functions as arguments. Consider: fun compose (f, n, x) = if n = 0 then x else f(compose(f, n-1, x)) This calls...

Functions and Type Inference

If you use patterns to access records or function arguments, you usually do not need to specify their types. They will be inferred from...

Functions, Pattern Matching And Val Bindings

The pattern {f1=x1, ..., fn=xn} will match against a record (assuming all the types match) {f1=v1,...,fn=vn}. Note that since all tuples...

Functions

Defining Functions Look at the following example to declare a function: fun pow(x:int, y:int) = if y = 0 then 1 else x * pow(x, y-1) If...