-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encode maps keeping keys in order. #30
base: master
Are you sure you want to change the base?
Conversation
to keep maps in order, we first sort it by keys by transforming them as list. Then we process the keys/values in order. ex: 2> B = sext:encode(#{ a => 1, b=>1 }). <<17,1,0,0,0,2,12,176,128,8,10,0,0,0,2,12,177,0,8,10,0,0, 0,2>> 3> B = sext:encode(#{ b => 1, a=>1 }). <<17,1,0,0,0,2,12,176,128,8,10,0,0,0,2,12,177,0,8,10,0,0, 0,2>>
I noticed that there are no quickcheck tests for maps, so I started adding some. This highlighted that some more implementation is needed – not least prefix encoding. |
i can probably add that. Did you already started the work on it? |
I started working on it. I got pretty far, but then – after starting a 1M test run of prop_sort(), discovered that the keysort order in maps differs from the normal term ordering: floats are always considered larger than ints. Needless to say, this poses a significant challenge for |
@uwiger sorry I missed it ... I will later today thanks :) |
Actually, we (Thomas Arts and I) have determined that there is still some work needed. I'll try to get back to it as quickly as I can. |
to keep maps in order, we first sort it by keys by transforming them as
list. Then we process the keys/values in order.
ex: