
Daniel Carrera
feucht@uni-koblenz.de wrote:
you may use a tuple? Hhhmm... I just tried it. It looks like Hugs doesn't like tuples with more than 5 elements. :-(
You can nest tuples. And that might be a good idea given that you know the size of the array, and it's conveniently a power of 2. data A2 a = A2 !a !a type A4 a = A2 (A2 a) type A16 a = A4 (A4 a) type A256 a = A16 (A16 a) It's not hard to index or assign into such an "array". You have a choice as to what to use as the type of indices into such an "array". It may be most convenient to use Int, but Word8 prevents out-of-bound errors, and A2 (A4 Bool) would probably be most elegant. (: -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig Science operates according to a law of conservation of difficulty. The simplest questions have the hardest answers; to get an easier answer, you need to ask a more complicated question. -- George Musser. Color Madness. Oddball maps can require more than four colors. Sci. Am., January 2003.