Hello.
I do remember that the “trick” was to coerce the record to a list before testing for inclusion. ( if {myrec} is in theList then .). I just want to reread the thread. If anybody has a link, or manages to dig it up for me, then it will be greatly appreciated.
Thanks.
Edit
I can as well post the reason for my curiousity: I have a handler that checks that a list contains unique pairs of integers.
When I test for uniqueness, then I test if the “pair”, from the list of lists are already included in some “probe-list”. Now, if I haven’t coerced the pair to a list before testing for inclusion the handler fails, which is odd, since one item of the handler is a list already.
The code probably does a better explanation than I do.
set theTestList to {{1, 1}, {1, 2}, {1, 3}, {2, 1}, {2, 2}, {3, 1}, {3, 3}, {1, 1}}
validPairList(theTestList)
on validPairList(L1)
-- The validity is that it contain an even number of elements
-- and that only pairs are among the elements.
--and that the pairs are unique.
set {tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ","}
set bits to text items of (L1 as text)
set AppleScript's text item delimiters to tids
set cnt to length of bits
set numPairs to length of L1
if cnt mod 2 = 0 and (numPairs * 2) = cnt then
global probe
set probe to {}
script o
property l : L1
end script
repeat with i from 1 to numPairs
if {item i of o's l} is not in probe then
-- ^^^^^^^^^^^^^^ if item i of o's l aren't coerced to a list
-- then the handler fails.
set end of probe to item i of o's l
else
return false
end if
end repeat
return true
else
return false
end if
end validPairList