[Tutor] tree-like functions call to find dependencies

Alan Gauld alan.gauld at btinternet.com
Thu Aug 2 21:11:05 CEST 2007


"Maxim Loginov" <zeliboba at mail.ru> wrote

> my problem is: I have (for example) 2 sets of quantity set(A,B,C) or
> set(A,B,D). I need to calculate another quantity E which is function
> of A,B,C or A,F. but F in turn is function of (A,B,D). ...
>  In reality dependecies of
> course deeper sets are longer and data are very big arrays ...
> I will need a function indirectly depending on already
> existed.

I'm not sure whether it applies or not but one approach would be
to use a dictionary where the keys are the required data sets
and the values are the functions.

Another approach is to use higher order functions that can
analyse the input data set and generate a function capable
of processing it.

A third option might enable the use of OOP and polymorphism,
provided the data can be categorized into a Liskoff compliant
type heirarchy.

Unfortunately its difficult to be sure without a lot more detail about
the rules, the size of data and the types of data.

Alan G 




More information about the Tutor mailing list