Functional programming in Fortran

It occurred to me that one way to set variables that cannot be changed is with ASSOCIATE, for example

program xassoc_ran
integer, parameter :: n = 10
real :: xraw(n)
call random_number(xraw)
associate (xmult => 100.0)
associate (xscaled => xmult * (xraw - sum(xraw)/n))
   write (*,"(*(f8.4))") xscaled
   ! xscaled = xscaled*5 ! illegal -- gfortran says Error: 'xscaled' at (1) associated to expression cannot be used in a variable definition context (assignment)
end associate
end associate
end program xassoc_ran

Another way, available since Fortran 90, is to define a subroutine where the fixed variables are declared as INTENT(IN) arguments.