Skip to main content
Commonmark migration
Source Link

I don't find these results consistent:

OrderedQ[{"a", "A"}]

True

OrderedQ[{"a2", "A1"}]

False

Is there any explanation of that somewhere? (In fact it is not necessarily related to Mathematica, maybe there are some standards or established conventions about this.)

One could think that the explanation is: since "a" and "A" are equivalent
and as OrderedQ[{"A", "A"}] returns True, it's normal. But in that case OrderedQ[{"A", "a"}] shouldn't return False.

###EDIT

EDIT

(Thanks to @Michael E2 comments)

It turns out that this question has nothing to do with the fact that "1" and "2" are digit characters. The same thing happens if one replaces "1" by "c" and "2" by "d" for example.

###EDIT2

EDIT2

This has been tested on Mathematica 11.3 and 5.1

I don't find these results consistent:

OrderedQ[{"a", "A"}]

True

OrderedQ[{"a2", "A1"}]

False

Is there any explanation of that somewhere? (In fact it is not necessarily related to Mathematica, maybe there are some standards or established conventions about this.)

One could think that the explanation is: since "a" and "A" are equivalent
and as OrderedQ[{"A", "A"}] returns True, it's normal. But in that case OrderedQ[{"A", "a"}] shouldn't return False.

###EDIT

(Thanks to @Michael E2 comments)

It turns out that this question has nothing to do with the fact that "1" and "2" are digit characters. The same thing happens if one replaces "1" by "c" and "2" by "d" for example.

###EDIT2

This has been tested on Mathematica 11.3 and 5.1

I don't find these results consistent:

OrderedQ[{"a", "A"}]

True

OrderedQ[{"a2", "A1"}]

False

Is there any explanation of that somewhere? (In fact it is not necessarily related to Mathematica, maybe there are some standards or established conventions about this.)

One could think that the explanation is: since "a" and "A" are equivalent
and as OrderedQ[{"A", "A"}] returns True, it's normal. But in that case OrderedQ[{"A", "a"}] shouldn't return False.

EDIT

(Thanks to @Michael E2 comments)

It turns out that this question has nothing to do with the fact that "1" and "2" are digit characters. The same thing happens if one replaces "1" by "c" and "2" by "d" for example.

EDIT2

This has been tested on Mathematica 11.3 and 5.1

edited title
Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

OrderQ OrderedQ with string arguments

Tweeted twitter.com/StackMma/status/1053299910957850624
EDIT2 added
Source Link
andre314
  • 19k
  • 1
  • 37
  • 73

I don't find these results consistent:

OrderedQ[{"a", "A"}]

True

OrderedQ[{"a2", "A1"}]

False

Is there any explanation of that somewhere? (In fact it is not necessarily related to Mathematica, maybe there are some standards or established conventions about this.)

One could think that the explanation is: since "a" and "A" are equivalent
and as OrderedQ[{"A", "A"}] returns True, it's normal. But in that case OrderedQ[{"A", "a"}] shouldn't return False.

###EDIT

(Thanks to @Michael E2 comments)

It turns out that this question has nothing to do with the fact that "1" and "2" are digit characters. The same thing happens if one replaces "1" by "c" and "2" by "d" for example.

###EDIT2

This has been tested on Mathematica 11.3 and 5.1

I don't find these results consistent:

OrderedQ[{"a", "A"}]

True

OrderedQ[{"a2", "A1"}]

False

Is there any explanation of that somewhere? (In fact it is not necessarily related to Mathematica, maybe there are some standards or established conventions about this.)

One could think that the explanation is: since "a" and "A" are equivalent
and as OrderedQ[{"A", "A"}] returns True, it's normal. But in that case OrderedQ[{"A", "a"}] shouldn't return False.

###EDIT

(Thanks to @Michael E2 comments)

It turns out that this question has nothing to do with the fact that "1" and "2" are digit characters. The same thing happens if one replaces "1" by "c" and "2" by "d" for example.

I don't find these results consistent:

OrderedQ[{"a", "A"}]

True

OrderedQ[{"a2", "A1"}]

False

Is there any explanation of that somewhere? (In fact it is not necessarily related to Mathematica, maybe there are some standards or established conventions about this.)

One could think that the explanation is: since "a" and "A" are equivalent
and as OrderedQ[{"A", "A"}] returns True, it's normal. But in that case OrderedQ[{"A", "a"}] shouldn't return False.

###EDIT

(Thanks to @Michael E2 comments)

It turns out that this question has nothing to do with the fact that "1" and "2" are digit characters. The same thing happens if one replaces "1" by "c" and "2" by "d" for example.

###EDIT2

This has been tested on Mathematica 11.3 and 5.1

Routine clean-up
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259
Loading
added 237 characters in body
Source Link
andre314
  • 19k
  • 1
  • 37
  • 73
Loading
deleted 141 characters in body
Source Link
andre314
  • 19k
  • 1
  • 37
  • 73
Loading
added 451 characters in body
Source Link
andre314
  • 19k
  • 1
  • 37
  • 73
Loading
edited tags
Link
Loading
Source Link
andre314
  • 19k
  • 1
  • 37
  • 73
Loading