valueDiff for arrays?

Mark Wieder ahsoftware at sonic.net
Fri Aug 3 18:54:40 EDT 2018


On 08/03/2018 10:40 AM, Richard Gaskin via use-livecode wrote:
> We have a command for obtaining the difference between arrays, where 
> "difference" is defined as having different keys.
> 
> What I could use at the moment is a means of obtaining an array which is 
> the difference is both keys present in one but not in the other, and 
> values that are different for those elements where they keys are present 
> in both.

Considering how easy the first part is to code, I doubt a feature 
request would get a second glance.

function arrayDifferences pArray1, pArray2
    local tDiff1, tDiff2, tDiffs

    difference pArray1 with pArray2 into tDiff1
    difference pArray2 with pArray1 into tDiff2
    union tDiff1 with tDiff2 into tDiffs
    return tDiffs
end arrayDifferences

For the second part, I'm not sure what the output would look like... do 
you want an array with duplicate keys? A multidimensional array with the 
same keys in each but different values? What's the use case?

-- 
  Mark Wieder
  ahsoftware at gmail.com




More information about the use-livecode mailing list