ConstMap == (was: Announcing E 0.8.4: The Birthday Release)

Mark S. Miller markm@caplet.com
Tue, 01 Jun 1999 14:17:50 -0700


Dean wrote:
>> if a count != B count
>>   return false
>> foreach k in A keys
>>   if A[k] != B[k]
>>      return false
>> return true

[#] C'mon guys, get with the syntax:

	escape return {
	    if (a size != b size) {
	        return(false)
	    }
	    for k in a {
	        if (a[k] != b[k]) {
	            return(false)
	        }
	    }
	    true
	}


At 04:41 AM 5/28/99 , Tyler Close wrote:
>I may be misunderstanding, but I think your pseudocode implies computing the
>hash code for every element. This is what I meant by hell to implement. 

[-] Doing this would be easy on us programmers.
Dean's code is essentially what we would do, and it would be just this easy 
to implement.  How efficient it runs is another matter.  It's linear time, 
much like other aggregate table operations.


>There is
>no way to do an element by element comparison between two hashtables since two
>equal hashtables will have different orderings if their underlying array sizes
>are not equal. Since these array sizes are dependent upon the insert/remove
>history of the hashtable and not its current content, two equal hashtables 
very
>likely do not use the same size of underlying array.

[?] I don't understand this.
By "no way", do you mean "no way without doing a hash lookup per element"?  
Is so, yes.


>I am guessing you know the above and just don't care about the cost of 
>computing
>n hash codes. My point was only that this is an expensive == operation 
>compared
>to == on a binary tree. Binary trees are made for this type of operation,
>hashtables are meant for single element lookup.

[+] I look forward to finding out about this.


	Cheers,
	--MarkM