[e-lang] [Caja] Equality of mappings in E

Bill Frantz frantz at pwpconsult.com
Wed Mar 11 22:15:19 EDT 2009


kpreid at mac.com (Kevin Reid) on Tuesday, March 10, 2009 wrote:

>On Mar 10, 2009, at 16:28, Mark S. Miller wrote:
>> On Tue, Mar 10, 2009 at 11:01 AM, David-Sarah Hopwood <david.hopwood at industrial-designers.co.uk 
>> > wrote:
>>
>> Mark S. Miller wrote:
>> > The corresponding cases in E without quasis:
>> >
>> >     ? ["a" => 1, "b" => 2] == ["b" => 2, "a" => 1]
>> >     # value: false
>> >
>> > They aren't equal because they are different.
>>
>> I'm surprised. The ASTs of the left- and right-hand sides are  
>> certainly
>> different, but this is testing whether the values are the same.
>> Why aren't the values the same?
>>
>> [Feel free to move this to e-lang.]
>>
>> Because their enumeration order is different.
>
>Note that if the maps are restricted to have string keys, then it is  
>not impossible to canonicalize the enumeration order.

It would seem that you could canonicalize the order for any ordered type,
including string. The process might have an execution time cost.

Cheers - Bill

---------------------------------------------------------------------------
Bill Frantz        | Barack Hussein Obama, President of the United States.
408-356-8506       | Now we can return to being a partner with the rest of
www.periwinkle.com | the world.


More information about the e-lang mailing list