==/EQ() and approx()
|
10-14-2016, 04:43 AM
Post: #4
|
|||
|
|||
RE: ==/EQ() and approx()
Hi, Tim,
Yes, I was referring specifically to the Bad Argument Type error on types other than two lists. Sorry; it looks like I should have provided some examples. Essentially, I was looking for some sort of analog to ==/SAME on the HP 48/49/50 family, or even ==/is in Python, which treat the objects being compared as atomic units but also work on objects of dissimilar types (where the exact mechanics vary slightly between == vs. SAME/is, but this isn't my primary concern at the moment). So, if a variable named ‘foo’ contains a string "1", then such a comparison operator (I'll just call it == for the same of example) would give: Code: foo=="1" → 1 (same type, same contents) or if ‘foo’ contains {}: Code: foo=={} → 1 EQ() was pretty much what I wanted except for the outright error if the types aren't the same—I was expecting it to simply return 0 in that case. This unfortunately complicates a task like simply checking if a variable contains, for instance, an empty list (vs. anything else, list or not); or if it contains a string of a specific value (vs. anything else, string, list or not), and so on. Instead of writing a simple one-line expression, it seems necessary to also wrap it inside an IFERR, or write additional code to check the types first, then the sizes if it's a list, etc. That's kind of a pain. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
==/EQ() and approx() - TravisE - 10-13-2016, 07:48 AM
RE: ==/EQ() and approx() - Tim Wessman - 10-13-2016, 05:56 PM
RE: ==/EQ() and approx() - Tim Wessman - 10-13-2016, 06:03 PM
RE: ==/EQ() and approx() - TravisE - 10-14-2016 04:43 AM
|
User(s) browsing this thread: 1 Guest(s)