It is not so easy. In some languages, you can pass pointers to nested functions in what is called closure . This is not possible in Fortran (or C and similar languages), since data is destroyed using a stack of a higher function. I suggest you try function objects, i.e. A class with a function pointer (or more) and the data needed for the function. Thus, you can even perform composition of functions and similar functional elements.
Read more on the concept of http://en.wikipedia.org/wiki/Function_object
The following is a sample for a function object to compose two single arguments:
module ComposeObj use Parameters use AritmFunctions implicit none private public Compose type Compose private procedure(fce),pointer,nopass :: f1 => null(),f2=>null() contains procedure,public :: call => helper endtype Compose interface Compose procedure NewCompose end interface contains function NewCompose(f,g) procedure(fce) :: f,g type(Compose) :: NewCompose NewCompose%f1 => f NewCompose%f2 => g end function NewCompose pure real(KND) function helper(this,x) class(Compose),intent(in) :: this real(KND),intent(in) :: x helper = this%f1(this%f2(x)) end function helper end module ComposeObj
source share