[erlang-questions] sorting rules regarding bit strings

Ulf Wiger ulf.wiger@REDACTED
Thu Apr 2 10:30:08 CEST 2009


Maybe I'm just unusually dense today, but what are
the sorting properties of bit strings?

5> lists:sort([<<1:1>>,<<1:2>>,<<1:3>>,<<1:4>>,
<<1:5>>,<<1:6>>,<<1:7>>,<<1:8>>, <<2:2>>,
<<2:3>>,<<2:4>>,<<1>>, <<16>>, <<128>>, <<255>>]).
[<<1>>,
  <<1>>,
  <<1:7>>,
  <<1:6>>,
  <<1:5>>,
  <<1:4>>,
  <<16>>,
  <<1:3>>,
  <<2:4>>,
  <<1:2>>,
  <<2:3>>,
  <<1:1>>,
  <<2:2>>,
  <<128>>,
  <<"ÿ">>]


Well, I think I can see the pattern, but is this really
what one wants?

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com




More information about the erlang-questions mailing list