Easy as { 1 2 3 }? (when { 1 2 3 } ≠ { 1 2 3 })
|
07-15-2018, 05:21 PM
Post: #8
|
|||
|
|||
RE: Easy as { 1 2 3 }?
That's nice, Dave!
In this particular case, I believe the "==" steps can all be safely replaced with SAME. SIZE always returns a real, so those comparisons are all ok. The comparison of similarly positioned integers where one is a ROM reference works fine with SAME as well (since at that point they're not being lumped in with the entire list), so the == passed to DOLIST can also be a SAME in this case. SAME is generally faster than ==, so that gives it a boost in speed. Of course, this doesn't apply if the intent is to allow reals and integers to be evaluated as equivalent (ie. 1. == 1). That wasn't my original goal, but it could certainly apply in other situations. 3 of the IFTE clauses can be encapsulated in {} instead of « », which saves a few bytes as well. Those changes reduce the size of the program from 183.5 to 161 bytes. Checking two lists of 1000 integers takes 18.8 seconds with the original code, and that reduces to 5.1 seconds with the alternate version. Code: « |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)