? evaluate functions when total # and types of functions are dynamic 
Author Message
 ? evaluate functions when total # and types of functions are dynamic

Hi:

Suppose I need to evaluate the sum of some function values. But I would
like to

allow the user to have the freedom to choose what are the functions the user
want

to use for the code.

To be more specific, I already have a MODULE prepared in advanced that has

func1, func2, func3, ..., funn.

The user has the freedom to decide what the user wants. Say the user wants

the 1st run to evaluate the sum of func1, func2, and func3. But the user can

have the 2nd run to evaluate the sum of func1, func4, func5, func11. Can I

programming in fortran90 to achieve this? If not, is there any programming

language does? If yes, how do I do that?

  Thank you,
by Cheng Cosine
Mar/18/2k2 UT



Sat, 04 Sep 2004 12:04:48 GMT  
 ? evaluate functions when total # and types of functions are dynamic
There's nothing direct in F90 that will do this.  The F2k procedure
pointers might nelp, but that's a long way away.

The only obvious thing I can think of is a direct series of IF
statements.

sum = 0
if (user_wants_1) sum = sum + func1(...)
if (user_wants_2) sum = sum + func2(...)
...
if (user_wants_11) sum = sum + func11(...)

Not very elegant, but it will do what you want.

Dick Hendrickson

Quote:

> Hi:

> Suppose I need to evaluate the sum of some function values. But I would
> like to

> allow the user to have the freedom to choose what are the functions the user
> want

> to use for the code.

> To be more specific, I already have a MODULE prepared in advanced that has

> func1, func2, func3, ..., funn.

> The user has the freedom to decide what the user wants. Say the user wants

> the 1st run to evaluate the sum of func1, func2, and func3. But the user can

> have the 2nd run to evaluate the sum of func1, func4, func5, func11. Can I

> programming in Fortran90 to achieve this? If not, is there any programming

> language does? If yes, how do I do that?

>   Thank you,
> by Cheng Cosine
> Mar/18/2k2 UT



Sun, 05 Sep 2004 01:07:44 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Typed Lambda Calculi and Total Recursive Functions

2. VC++ calling fortran function and fortran function calling a c++ function

3. Calling functions from functions from functions ...

4. EVALUATE functions dynamically

5. Need a MAX -like function to evaluate several fields

6. evaluating a variable as a function call?

7. MIT Scheme map function evaluates back to front?

8. Out of curiosity: evaluating transcendental functions

9. type-checking / type() function

10. Partially evaluated functions

11. How to make a function work with different type and kind type argument

12. having trouble evaluating function, help!

 

 
Powered by phpBB® Forum Software