[comp.lang.apl] building arrays

rockwell@socrates.umd.edu (Raul Rockwell) (06/27/91)

If you build an array, recursively or iteratively, by catenating items
onto the array, it seems like J requires O(n^2) for array
construction.  If, instead of straight catenation, you use something
like ( cons=. ,&< ) you could construct a representation of the data
in O(n) time.  However, it is not readily apparent to me how to
convert such a representation into a flat array in linear time.

It might be possible to pull some stunts with enlist to remove all
structure, then using cut to restore structure, but I'm not sure how
fast enlist is (or how fast it ought to be).

Are there any good ways for dealing with this issue?

-- 
Raul <rockwell@socrates.umd.edu>