defining a named function with explicitly named arguments
``incrementInteger :: Int -> IntincrementInteger n = n + 1``
``incrementInteger[n_Integer] := n + 1;``
defining a named function with lambda expression
``incrementInteger :: Int -> IntincrementInteger = \n -> n + 1``
``incrementInteger = Function[{n}, n + 1];``
defining a function with a function name as one of the arguments
``Prelude> increment = \x -> x+1Prelude> double = \x -> 2*xPrelude> thenDouble someFunc = double . someFuncPrelude> thenDouble increment 38``
``In[1]:= double = Function[x, 2x];increment = Function[x, x + 1];thenDouble[someFunc_] := Composition[double, someFunc];In[4]:= thenDouble[increment]Out[4]= Function[x, 2 x]@Function[x, x + 1]In[5]:= (thenDouble[increment])[3]Out[5]= 8``
defining a function with locally definded intermediate functions
``Prelude> :{Prelude> myFunc1 x =Prelude>     let y = sin xPrelude>     in cos yPrelude> :}Prelude> myFunc1 pi1.0Prelude> :{Prelude> myFunc2 x =Prelude>     cos yPrelude>     wherePrelude>         y = sin xPrelude> :}Prelude> myFunc2 pi1.0``
``In[1]:= myFunc[x_]:=With[{f=Sin[x]},Cos[f]]myFunc[Pi]Out[2]= 1``
Alternatively, instead of using `With` (for symbolic replacement), use `Module` (for lexical scoping) or `Block` (for dynamic scoping).