Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by johngg (Canon)
on Dec 25, 2017 at 12:00 UTC ( [id://1206163]=note: print w/replies, xml ) Need Help??


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

Since you are testing some sort of logical order which is not necessarily sorted how about is_ordered()?

Cheers,

JohnGG

  • 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 ikegami (Patriarch) on Dec 25, 2017 at 20:46 UTC

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

      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).

Re^2: A proper name for is_sorted function that can check more than just sorting order?
by Laurent_R (Canon) on Dec 25, 2017 at 16:32 UTC
    I was thinking also about something like that, is_ordered or some variation thereon, such as is_in_order, when I read the OP.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1206163]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-25 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found