On 2018-08-05 21:25, Richard Gaskin via use-livecode wrote:
Brian Milby wrote:
I think Mark's code had a typo (left returned too many keys), but even
when corrected it takes half the time as a pure LCS solution. Here's
my modification:
function bwmValueDiff pLeft, pRight
local tResult
intersect pLeft with pRight into tResult["1"]
repeat for each key tKey in tResult["1"]
if pLeft[tKey] is pRight[tKey] then
delete variable tResult["1"][tKey]
end if
end repeat
intersect pRight with tResult["1"] into tResult["2"]
return tResult
end bwmValueDiff
That looks like LCS. What is the "pure LCS solution" you were
comparing it to?
I think Brian means where it does not use intersect - i.e. all loops are
in LCS.
FWIW - I'm pretty sure this operation can be done using only two loops
(one over left, and one over right).
Also, I'm pretty sure that a 'pure' LCS solution of that as suggested
above would actually be faster than the minimum 3 loops needed if you
use engine array ops - above a certain array size.
However, I haven't had a chance to code it yet.
Warmest Regards,
Mark.
--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode