in reply to A proper name for is_sorted function that can check more than just sorting order?

I think the proper mathematical name for that is monotonicity. So you could name your function is_monotonous or something alike.
  • Comment on Re: A proper name for is_sorted function that can check more than just sorting order?
  • Download Code

Replies are listed 'Best First'.
Re^2: A proper name for is_sorted function that can check more than just sorting order?
by LanX (Saint) on Dec 30, 2017 at 18:20 UTC
    After having a closer look into all aspects discussed in the WP page, I'm afraid that my intuition wasn't too bad and "Monotonicity" is indeed not a good idea.

    Basically because it defines for all elements x ≤ y => f(x) ≤ f(y)

    Since the OP is only testing adjacent elements, this can only be true with a transitive relation inside the testing block.

    But this can't be guaranteed because the user is free to apply any code there.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Wikisyntax for the Monastery

Re^2: A proper name for is_sorted function that can check more than just sorting order?
by LanX (Saint) on Dec 28, 2017 at 15:37 UTC
    Excellent point, but from my intuition does monotonicity imply transitivity.

    That is a < b and b < c implies a < c and that's not necessarily the case with this construct.

    But since a quick look into the WP page doesn't reveal any mention of transitivity you might be right.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Wikisyntax for the Monastery