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;

  1. write class array of n dimensions/axes, each of length m, , index them.

  2. write generalised function can iterate through elements in such array via n nested for loops, array of dimension n.

  3. 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

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -