• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trimming down a list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trimming down a list


  • Subject: Re: Trimming down a list
  • From: Paul Berkowitz <email@hidden>
  • Date: Wed, 10 Apr 2002 09:37:08 -0700

On 4/10/02 8:58 AM, "Steve Thompson" <email@hidden> wrote:

> Now I'm really confused. Thank you for your example, Paul. I've created a
> sub called RemoveDuplicates and I've passed my long list to it. The script
> makes sense. The loop steps through each item of listRef to see if it's in
> k. If it isn't it adds it to the end.
>
> My sample file that I'm testing my script on contains 11,768 items. With
> this script that should work as you've written it (ie, it makes sense to me)
> I now get the first item in the list returned 11,768 times.
>
>> if thisItem is not in k then set end of k to thisItem
>
> Makes sense to me. What's going on?
>

Is it possible that you wrote

item 1

instead of

item i

in the line:

set thisItem to item i of RemoveDups's listRef

?

>> if thisItem is not in k then set end of k to thisItem
>
> I changed it to:
>
> if thisItem is not in k then set k to k & thisItem
>
> And it works. Is that a bug or does list not understand end of?


I've heard tell of limitations with very long lists, but i don't believe it
applies to 'set the end of' to.

Reduce your list to under 4500 items and try again. Does it work now? (There
is another limit around 4600, but it shouldn't apply to 'end of'.) Can you
find a point at which it breaks?

If it does, you would be better to break the list into sublists of about
4000 items each, do the 'end of' technique, and then concatenate (&) the
sublists together if you can do it in a way that doesn't give you
duplicates. I'll get back to this a little later. In the meantime, as I
already pointed out the first time, you should not do:

if thisItem is not in k then set k to k & thisItem

If you _have_ to concatenate, do it this way:

if thisItem is not in k then set k to k & {thisItem}

But that really should not be necessary.

--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Trimming down a list (From: Steve Thompson <email@hidden>)

  • Prev by Date: Re: Trimming down a list
  • Next by Date: Re: Internet Shortcut _ Urgent
  • Previous by thread: Re: Trimming down a list
  • Next by thread: Re: Trimming down a list
  • Index(es):
    • Date
    • Thread