2 ms·
> Fairly simple things like [1,2] < [10,2] return false (unlike every other language I’ve ever used) What other languages, besides Python, does this builtin li
by lelanthran 3y ago
> Fairly simple things like [1,2] < [10,2] return false (unlike every other language I’ve ever used)
What other languages, besides Python, does this builtin list comparison work in?
What's the result when the comparison is `[1, 2] < ["10", "2"]`?
- s-lambert 3y agoI've never seen this usage of list comparison before but apparently it works in Rust (both of these print true): println!("{}", vec![1, 2] < vec![10, 2]); println!("{}", (1, 2) < (10, 2));
- CJefferson 3y agoList comparison works lexicographically in Haskell, C++ (using std::vector or std::array), Rust, GAP, every language I personally use. Comparing strings and bits is always going to be weird, so I’ve not tested it.