function - Writing a generalised passive metafunction for an array class -
this conceptual, non language specific question.
i know these less ideal, think question still quite clear , simple...
what want just;
write class array of n dimensions/axes, each of length m, , index them.
write generalised function can iterate through elements in such array via n nested for loops, array of dimension n.
have function nothing, "template", can interact function performs specific action, eg function sets every value in array 1.
i don't have deep enough programming knowledge know how easy such thing implement, in language. while idea extremely simple, haven't seen similar example of such flexible , inert "meta" function, or if such thing practicable.
so if give me feedback towards performing such implementation, speaking generally, or citing specific language example, helpful.
edit: pseudocode illustration
class array(arrayaxesnumber, arrayaxeslength) trackallelements (array) #iterate through arrayaxes1# #iterate through arrayaxes2# pass; #iterate through arrayaxes2# #iterate through arrayaxes3# pass; " " " #iterate arrayaxes (arrayaxesnumber-1)# #iterate through (arrayaxesnumber)# pass;
as can see in illustration, problem appears call non specific number of nested for loops.
to clarify 3., want able apply function this, eg
setallelementstoone(trackallelements) #set each element one#
Comments
Post a Comment