Reading arrays, 3 methods tested, results

Richard Gaskin ambassador at fourthworld.com
Wed Jul 27 17:34:58 EDT 2016


Phil Davis wrote:

 > Hey Richard,
 >
 > Wouldn't it give more accurate results to compare arrays without
 > encoding them, rather than comparing the encoded arrays? Isn't
 > encoded string way roughly 100% likely to be 'not equal'?

Is it?

Modifying my code to come up with examples using different algos, I was 
able to get a "true" in my routine.

Two benefits of arrayEncode there are that it makes the output visible, 
so you can see (at least roughly) how they're different, and it lets us 
get a length for the array data, which can be helpful given that many 
things in LC's binary encoded array format will display as non-printing 
characters (numbers, for example, as stored in binary form).

Now that = can be used to recursively compare arrays that may not be a 
bad option, or even better to translate the output to JSON for even 
better visibility.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list