From: Eric B. <er...@go...> - 2007-12-13 15:10:33
|
Andreas Leitner wrote: > I am having problem with DS_HASH_TABLE. I have seen that DS_HASH_TABLE > [G, K] conforms to DS_BILINEAR [G]. I am not sure if this is abuse, but > I wanted to sell my hash table to others as a bilinear of the values in > the hash table. Eg. given the table ["a" -> "1", "b" -> "2"] sold with > the static type DS_BILINEAR appears to be the list ["1", "2"]. No abuse here. > My problem is that this list always contains also Void, even though Void > is not a value in the hash table. Also DS_HASH_TABLE.to_array does not > contain Void. > > Is there somewhere an off by one error I don't know. I need more information to reproduce the problem. I just wrote this test, but it works as expected. test_bilinear is -- Test hash-tables as being bilinear. local l_table1: DS_HASH_TABLE [STRING, STRING] l_bilinear1: DS_BILINEAR [STRING] i: INTEGER do create l_table1.make (5) l_table1.force_last ("1", "one") l_table1.force_last ("2", "two") l_table1.force_last ("3", "three") l_table1.force_last ("4", "four") l_table1.force_last ("5", "five") l_bilinear1 := l_table1 from l_bilinear1.start until l_bilinear1.after loop i := i + 1 assert_strings_equal ("item_" + i.out, i.out, l_bilinear1.item_for_iteration) l_bilinear1.forth end end -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |