The problem with the parameter is only that you can't define the constant array to depend on itself. But you could define the fundamental quantities, and then the whole array including the derived quantities, as so:
program foo
implicit none
real, dimension(2), parameter :: basic = [2.4, 1.4]
real, dimension(4), parameter :: all = [basic(1), basic(2), &
basic(1)*basic(2)**basic(1), &
abs(basic(1))]
print *, basic
print *, all
end program foo
and in fact if you want to go that way, you might as well name the fundamental quantities:
program foo
implicit none
real, parameter :: height = 2.4, bodymass = 1.4
real, dimension(4), parameter :: all = [height, bodymass, &
height*bodymass**2, &
abs(height)]
print *, height, bodymass
print *, all
end program foo
I can't imagine height is the sort of thing you need to take the absolute value of, but you see my point.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…