merge property lists


[ Zettels Traum ] [ search / suche ]

von dp am 06.Maerz 97 um 01:12:52:

zu: compare lists von dp am 14.Februar 97 um 20:42:28:

At 8:46 PM +0000 3/5/97, Cedric Haindl wrote:
>is it possible to merge to property-lists. I need to find a value in either
>the first or the second list, so I thought (well maybe I shouldn't) to
>merge the two of them and search for the value in the new list. Is there a
>way to do that
>comfortably?

Just do this instead:

set p = getaProp (list1, #someprop)
if voidP(p) then set p = getaProp (list2, #someprop)

If you use it often, you could even write a handler to make it easier:

on checkListsForProp listOfList, prop
repeat with l in listOfLists
set p = getaProp (l, prop)
if not (voidP (p)) then return p
end repeat
return p --p will be void here
end checkListForProp

And you could do

set myProp = checkListsForProp ([list1, list2], #someprop)

Tom Collins


Dazu:























D. Plänitz