Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!TARDIS.CRAY.COM!cargo From: cargo@TARDIS.CRAY.COM (David S. Cargo) Newsgroups: comp.lang.icon Subject: table initialization Message-ID: <9002012052.AA03270@zk.cray.com> Date: 1 Feb 90 20:52:14 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 24 I was looking at implementing some Icon code to initialize font width tables. Naturally I thought about using tables to do this. I then realized that while most other structures can be initialized with constants, there doesn't seem to be a convenient way to do this with tables. Or is there something I'm missing. What I will probably wind up doing is either using lists indexed by character values (using ord(s)) or using two constant lists to initialize a table, char_val and char_width are the two lists: every i := 1 to n do width[char_val[i]] := char_width[i] Eventually I'll probably want to know which is faster to use, a character width table or and array indexed using ord(s)) string_width := 0 # for either case every string_width +:= char_width[ord(!s)] # for a list every string_width +:= char_width[!s] # for a table It would seem to be a trade between ease of access and creation of temporaries. Has anybody tried anything like this already and found an answer to which is better speed-wise?