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

The OP's issue is that it can be used for testing other things too (as they demonstrated), and the name should reflect that.

  • Comment on Re^2: A proper name for is_sorted function that can check more than just sorting order?

Replies are listed 'Best First'.
Re^3: A proper name for is_sorted function that can check more than just sorting order?
by Laurent_R (Canon) on Dec 25, 2017 at 22:26 UTC
    Yes, you're quite right. I was thinking that is_ordered was better than is_sorted, because it would reflect some more general notion of order than just sorting order, but it is true that, for example, the $a->{end_date} eq $b->{start_date} example doesn't really have anything to do with order (even with a strongly customized idea of order).

    But then, it is difficult to find a general name for that. Perhaps something like match_property or something in that direction would be better.

      After reading this thread again, I'm thinking about a pair of names - seo-friendly is_sorted (or is_ordered) implying proximity to sort plus reduce_ok or similar that is for arbitrary checks. The implementation may be the same under the hood. There's no way to tell whether user supplied a total/partial order like gt/le or arbitrary structure check or mix of both.

      I'm also thinking about incorporating compound checks suggested by 1nickt via subtests, if Test::Builder allows me to (but it should).