in reply to Re^2: Filtering array of strings and numbers
in thread Filtering array of strings and numbers

I had the same reaction. I would think that the ne, eq, etc. string relational operators all coerce their arguments into strings, so that no explicit stringification is needed. But I may miss something.

Having said that, string comparison operators and arithmetic relational operator don't always return the same thing, so the OP should be aware of that. Remember that 10 is smaller than 3 for string relational operators.

  • Comment on Re^3: Filtering array of strings and numbers

Replies are listed 'Best First'.
Re^4: Filtering array of strings and numbers
by AnomalousMonk (Archbishop) on Apr 29, 2016 at 18:26 UTC
    ... string relational operators all coerce their arguments into string, so that no explicit stringification is needed. But I may miss something.

    The OP uses, and Athanasius's reply explicitly assumes, an equality operator, so I don't think you're missing anything. If you are, I'm missing it too, and I'd be very interested to learn what it is. (Update: Ok, here's something I missed.)

    I agree with you that if you try to use numeric instead of string comparison, you're venturing out onto very thin ice indeed.

    Update: I'm posting this reply again because the first post does not seem to appear in its intended parent thread. I can see the first version of this reply (update: this node) in the history of my posts in my personal node, but there is no link to any parent; it seems to be freely floating somewhere in cyberspace.


    Give a man a fish:  <%-{-{-{-<