so how do you sort [10,9,"egg",{name:"foo"},true] ?
-
-
-
sort by type, then sort inside type. Erlang: > lists:sort([10,1,0,2,"abc", false, true, "xyz"]). [0,1,2,10,false,true,"abc","xyz"]
-
Shouldn't it be the following? > lists:sort([10,1,0,2,"abc", false, true, "xyz"]). [0,1,10,2,false,true,"abc","xyz"]
-
last time I checked 2 goes before 10
-
True, but I believe JavaScript won't agree. In the picture you posted, you can see that ;)
-
> 2 < 10 true
কথা-বার্তা শেষ
নতুন কথা-বার্তা -
-
-
пачему?
-
Лексиграфическая сортировка by default
-
ага, и конвертация в строки где-то по ходу
কথা-বার্তা শেষ
নতুন কথা-বার্তা -
-
-
FWIW, it's lexicographical, and it's perfectly rational, although certainly not expected. But it's common in UNIX/Linux/BSD also: $ echo -e "10\n9\n8\n3\n2\n1\n0" | sort 0 1 10 2 3 8 9 https://en.wikipedia.org/wiki/Lexicographical_order …
-
still, bash doesn’t have types, and JS pretends it does
-
It's not Bash that's sorting the numbers. It's GNU sort(1), part of "coreutils", and it does have a numerical type: $ echo -e "10\n9\n8\n3\n2\n1\n0" | sort -n 0 1 2 3 8 9 10 Also supports an alphabetic type, signed vs. unsigned integers, IEEE NaN, etc.
-
In my case, it's GNU sort(1), that is. BSD, UNIX, etc may ship different sort(1) packages that handle data types differently.
কথা-বার্তা শেষ
নতুন কথা-বার্তা -
-
-
-
Same in python as well
কথা-বার্তা শেষ
নতুন কথা-বার্তা -
-
I had to check this was not an Onion tweet... sure enough JS strikes again. Oh JS how I loathe thee....pic.twitter.com/rniQVXCf12
ধন্যবাদ। আপনার সময়রেখাকে আরো ভালো করে তুলতে টুইটার এটিকে ব্যবহার করবে। পূর্বাবস্থায়পূর্বাবস্থায়
-
-
-
The default sort function converts objects to strings. try this...pic.twitter.com/f4OJA4hXwo
ধন্যবাদ। আপনার সময়রেখাকে আরো ভালো করে তুলতে টুইটার এটিকে ব্যবহার করবে। পূর্বাবস্থায়পূর্বাবস্থায়
-
লোড হতে বেশ কিছুক্ষণ সময় নিচ্ছে।
টুইটার তার ক্ষমতার বাইরে চলে গেছে বা কোনো সাময়িক সমস্যার সম্মুখীন হয়েছে আবার চেষ্টা করুন বা আরও তথ্যের জন্য টুইটারের স্থিতি দেখুন।