Emulating associative arrays in AppleScript
A problem that would be trivial to solve with key=>value pairs. For each
item in list_a, find the matching item in list_b and compare a single
attribute (calculate scale ratio for two sets of images).
The AppleScript lists look something like this:
listA = {{filename:"filename X.tif",width:"500"},{filename:"filename
Z.tif",width:"200"}, ...}
listB = {{filename:"filename Z.tif",width:"400"},{filename:"filename
v.tif",width:"222"}, ...}
Both lists may contain a different number of items/order, making it
impossible to relay on nth item of list for selecting pairs
While it would be possible to iterate over every object in listA and
compare its filename property with every object of listB, this is horribly
inefficient, even with just a few hundred items.
Is it possible to solve this using AppleScript or must I serialize the
objects and pass the evaluation task to an external script that support
assoc. arrays?
No comments:
Post a Comment